chenzx
2024-12-11 4043a2fe2103c7960b74acbccdcc876d11f83f0f
GasolineBlend/Controllers/TreeDiagramRecord.cs
@@ -15,7 +15,7 @@
    {
        private TreeDiagramRecordBLL _acc = new TreeDiagramRecordBLL();
        /// <summary>
        ///获取地区智能体数据
        ///获取查询历史数据
        /// </summary>
        /// <param name="CompanyName"></param>
        /// <returns></returns>
@@ -39,7 +39,7 @@
        }
        /// <summary>
        ///添加智能体
        ///添加历史数据
        /// </summary>
        /// <param name="Keyword"></param>
        /// <returns></returns>
@@ -48,8 +48,13 @@
        {
            try
            {
                bool isDeleted = _acc.AddTreeDiagramRecord(treeDiagramRecord);
                return isDeleted ? SuccessNoShow() : Error();
                var list = _acc.GetTreeDiagramRecordIsName(treeDiagramRecord.CompanyName);
                if (list.Count == 0)
                {
                    bool isAdd = _acc.AddTreeDiagramRecord(treeDiagramRecord);
                    return isAdd ? SuccessNoShow() : Error();
                }
                return SuccessNoShow(data: null);
            }
            catch (Exception e)
            {
@@ -60,5 +65,36 @@
            }
        }
        /// <summary>
        ///修改历史数据
        /// </summary>
        /// <param name="Keyword"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult UpdateTreeDiagramRecord(TreeDiagramRecord treeDiagramRecord)
        {
            try
            {
                var list = _acc.GetTreeDiagramRecordIsName(treeDiagramRecord.CompanyName);
                if (list != null && list.Count != 0)
                {
                    bool isUpdata = _acc.UpdateTreeDiagramRecord(treeDiagramRecord);
                    return isUpdata ? SuccessNoShow() : Error();
                }
                else {
                    bool isUpdata = _acc.AddTreeDiagramRecord(treeDiagramRecord);
                }
                return SuccessNoShow(data: null);
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "修改智能体 UpdateTreeDiagramRecord" +
                    "" +
                    "", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
    }
}