Exemplo n.º 1
0
        private void OptData()
        {
            /********   可修改区域 Start  ********/
            Model.WEB.CustomerDocumentary_Model model = GetNewDataModel(CurrentContext);
            /********   可修改区域 End  ********/

            bool   issuccess = false;
            string msg       = string.Empty;

            try
            {
                if (IsAdd)
                {
                    issuccess = bll.AddModel(model);
                    msg       = issuccess ? "添加成功。" : "添加失败!";
                }
                else
                {
                    model.EditTime = DateTime.Now;
                    issuccess      = bll.UpdateModel(model);
                    msg            = issuccess ? "修改成功。" : "修改失败!";
                }
            }
            catch (Exception ex)
            {
                issuccess = false;
                msg       = string.Format("{0} {1}", msg, ex.Message);
            }
            ReturnMsg(issuccess, enumReturnTitle.OptData, msg);
        }
Exemplo n.º 2
0
        /********  获取数据  可修改区域 Start  ********/
        private Model.WEB.CustomerDocumentary_Model GetNewDataModel(HttpContext context)
        {
            Model.WEB.CustomerDocumentary_Model model = new Model.WEB.CustomerDocumentary_Model();
            if (IsEdit)
            {
                model = bll.GetModelByKeyValue(_pKeyValue);

                if (null == model)
                {
                    throw new HasNotRecordException(_pKeyValue);
                }
                else
                {
                    if (model.ContainProperty("EditTime"))
                    {
                        model.EditTime = DateTime.Now;
                    }
                }
            }
            else
            {
                if (model.ContainProperty("CreateTime"))
                {
                    model.CreateTime = DateTime.Now;
                }
                if (model.ContainProperty("Creator"))
                {
                    model.Creator = CurrentUser.BaseInfo.LoginID;
                }
            }

            model.ID = string.IsNullOrWhiteSpace(_pKeyValue) ? 0 : int.Parse(_pKeyValue);

            model.CustomerCode = UrlHelper.ReqIntByGetOrPost(context, "CustomerCode");

            model.DocumentaryPeople = UrlHelper.ReqStrByGetOrPost(context, "DocumentaryPeople");

            model.CustomerLevel = UrlHelper.ReqStrByGetOrPost(context, "CustomerLevel");

            model.SalesStage = UrlHelper.ReqStrByGetOrPost(context, "SalesStage");

            model.DocumentaryContent = UrlHelper.ReqStrByGetOrPost(context, "DocumentaryContent");

            model.NextDocumentaryDate = UrlHelper.ReqDateTimeByGetOrPost(context, "NextDocumentaryDate");

            model.ReminderNote = UrlHelper.ReqStrByGetOrPost(context, "ReminderNote");

            model.Attachment = UrlHelper.ReqStrByGetOrPost(context, "Attachment");

            return(model);
        }