using CommonHelper;
using GasolineBlend.BLL;
using GasolineBlend.Entity;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace GasolineBlend.Controllers
{
public class TreeDiagramRecordController : BaseController
{
private TreeDiagramRecordBLL _acc = new TreeDiagramRecordBLL();
///
///获取查询历史数据
///
///
///
[HttpPost]
public ActionResult GetTreeDiagramRecordIsName(string CompanyName)
{
try
{
var list = _acc.GetTreeDiagramRecordIsName(CompanyName);
if (list != null && list.Count > 0)
{
return SuccessNoShow(data: list);
}
return SuccessNoShow(data: null);
}
catch (Exception e)
{
LogHelper.Write(Level.Error, "获取地区智能体数据 GetTreeDiagramRecordIsId", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
return Error();
}
}
///
///添加历史数据
///
///
///
[HttpPost]
public ActionResult AddTreeDiagramRecord(TreeDiagramRecord treeDiagramRecord)
{
try
{
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)
{
LogHelper.Write(Level.Error, "添加智能体 AddTreeDiagramRecord" +
"" +
"", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
return Error();
}
}
///
///修改历史数据
///
///
///
[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();
}
}
}
}