示例#1
0
        /// <summary>
        /// 修改数据类型
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public Result <int> UpdateType(Base_TypeDictionary model)
        {
            var oldModel = DataOperateBasic <Base_TypeDictionary> .Get().GetModel(model.Id);

            model = FiterUpdate(oldModel, model);

            Result <int> result = new Result <int>();

            try
            {
                var rows = DataOperateBasic <Base_TypeDictionary> .Get().Update(model);

                if (model.Type == "MilepostType")
                {
                    var parent = DataOperateBusiness <Epm_Milepost> .Get().GetList(i => i.ParentId == 0 && i.Code == model.No && i.IsDelete == false).FirstOrDefault();

                    parent.Name = model.Name;

                    DataOperateBusiness <Epm_Milepost> .Get().Update(parent);
                }
                result.Data = rows;
                result.Flag = EResultFlag.Success;
                WriteLog(AdminModule.TypeDictionary.GetText(), SystemRight.Modify.GetText(), "修改数据类型:" + model.Id + ":" + model.Name);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "UpdateType");
            }
            return(result);
        }
        public ActionResult Add(Base_TypeDictionary model)
        {
            ResultView <int> view = new ResultView <int>();

            //表单验证
            if (string.IsNullOrEmpty(model.Name))
            {
                view.Flag    = false;
                view.Message = "名称不能为空";
                return(Json(view));
            }
            if (string.IsNullOrEmpty(model.No))
            {
                view.Flag    = false;
                view.Message = "编号不能为空";
                return(Json(view));
            }
            Result <int> result = new Result <int>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.AddType(model);
            }
            return(Json(result.ToResultView()));
        }
示例#3
0
        /// <summary>
        /// 添加类型
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public Result <int> AddType(Base_TypeDictionary model)
        {
            model = base.SetCurrentUser(model);
            Result <int> result = new Result <int>();

            try
            {
                var rows = DataOperateBasic <Base_TypeDictionary> .Get().Add(model);

                if (model.Type == "MilepostType")
                {
                    var list = DataOperateBusiness <Epm_Milepost> .Get().GetList(i => i.ParentId == 0 && i.IsDelete == false).ToList();

                    Epm_Milepost mil = new Epm_Milepost();
                    mil.ParentId = 0;
                    mil.Code     = model.No;
                    mil.Name     = model.Name;
                    mil.State    = 1;
                    mil.IsDelete = false;
                    mil          = base.SetCurrentUser(mil);
                    DataOperateBusiness <Epm_Milepost> .Get().Add(mil);
                }

                result.Data = rows;
                result.Flag = EResultFlag.Success;
                WriteLog(AdminModule.TypeDictionary.GetText(), SystemRight.Add.GetText(), "新增数据类型:" + model.Id + ":" + model.Name);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "AddType");
            }
            return(result);
        }
        public ActionResult Index(string name, string typeNo, int pageIndex = 1, int pageSize = 10)
        {
            ResultView <string> view = new ResultView <string>();

            if (string.IsNullOrEmpty(typeNo))
            {
                view.Flag    = false;
                view.Message = "模板标识不能为空";
                return(Json(view));
            }
            Base_TypeDictionary tempType = GetTempType(typeNo);

            Helper.IsCheck(HttpContext, GetModule(tempType.Name + "模板"), SystemRight.Browse.ToString(), true);

            QueryCondition      qc = new QueryCondition();
            ConditionExpression ce = null;

            ce             = new ConditionExpression();
            ce.ExpName     = "TemplateTypeId";
            ce.ExpValue    = tempType.Id;
            ce.ExpOperater = eConditionOperator.Equal;
            ce.ExpLogical  = eLogicalOperator.And;
            qc.ConditionList.Add(ce);
            if (!string.IsNullOrEmpty(name))
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "Title";
                ce.ExpValue    = "%" + name + "%";
                ce.ExpOperater = eConditionOperator.Like;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            qc.PageInfo = GetPageInfo(pageIndex, pageSize);
            Result <List <Epm_Template> > result = new Result <List <Epm_Template> >();

            using (BusinessClientProxy proxy = new BusinessClientProxy(ProxyEx(Request)))
            {
                result = proxy.GetTemplateList(qc);
            }
            ViewBag.Total        = result.AllRowsCount;
            ViewBag.name         = name;
            ViewBag.typeNo       = typeNo;
            ViewBag.pageIndex    = pageIndex;
            ViewBag.TemplateId   = tempType.Id;
            ViewBag.TemplateName = tempType.Name;
            return(View(result.Data));
        }
示例#5
0
        /// <summary>
        /// 获取类型列表
        /// </summary>
        /// <param name="qc"></param>
        /// <returns></returns>
        public Result <List <Base_TypeDictionary> > GetTypeList(QueryCondition qc)
        {
            qc = AddDefault(qc);
            Result <List <Base_TypeDictionary> > result = new Result <List <Base_TypeDictionary> >();

            try
            {
                result = hc.Plat.Common.Service.DataOperate.QueryListSimple <Base_TypeDictionary>(context, qc);

                var pIds = result.Data.Select(i => i.PId).ToList();
                pIds.RemoveAll(i => i == 0);
                if (pIds.Count() > 0)
                {
                    List <Base_TypeDictionary> list = new List <Base_TypeDictionary>();
                    var parents = DataOperateBasic <Base_TypeDictionary> .Get().GetList(i => pIds.Contains(i.Id)).ToList();

                    foreach (var item in result.Data)
                    {
                        Base_TypeDictionary model = item;
                        model.PName = "";
                        if (item.PId != 0)
                        {
                            model.PName = parents.FirstOrDefault(i => i.Id == model.PId).Name;
                        }
                        list.Add(model);
                    }
                    result.Data = list;
                }
            }
            catch (Exception ex)
            {
                result.Data      = null;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "GetTypeList");
            }
            return(result);
        }
示例#6
0
 /// <summary>
 /// 修改类型
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public Result <int> UpdateType(Base_TypeDictionary model)
 {
     return(base.Channel.UpdateType(model));
 }
示例#7
0
 /// <summary>
 /// 添加类型
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public Result <int> AddType(Base_TypeDictionary model)
 {
     return(base.Channel.AddType(model));
 }