示例#1
0
        /// <summary>
        /// 编辑公司信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Edit()
        {
            string CompanyID   = WebUtil.GetFormValue <string>("CompanyID");
            string CompanyName = WebUtil.GetFormValue <string>("CompanyName");

            CompanyProvider provider = new CompanyProvider();
            CompanyEntity   entity   = new CompanyEntity();

            entity.CompanyID   = CompanyID;
            entity.CompanyName = CompanyName;

            int line = provider.Update(entity);

            DataResult dataResult = new DataResult();

            if (line > 0)
            {
                dataResult.Code    = (int)EResponseCode.Success;
                dataResult.Message = "编辑成功";
            }
            else
            {
                dataResult.Code    = (int)EResponseCode.Exception;
                dataResult.Message = "编辑失败";
            }
            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
示例#2
0
        protected void btn_sure_Click(object sender, EventArgs e)
        {
            Company         company  = this.AddCompany();
            CompanyProvider provider = new CompanyProvider();

            switch (this.OperationFlag)
            {
            case Operation.Add:
                if (this.IsSame() == 1)
                {
                    break;
                }
                if (provider.Insert(company))
                {
                    this.Alert("添加成功!!!");
                    this.TextCancel();
                }
                break;

            case Operation.Update:
                if (provider.Update(company))
                {
                    this.Alert("修改成功!!!");
                    this.BindText();
                }
                break;
            }
        }