コード例 #1
0
        public ActionResult Edit(CompanyEdit model)
        {
            //日期格式转换成Unix时间戳格式。
            if (!string.IsNullOrEmpty(model.setDate))
            {
                model.setDate = DateTimeHelper.ConvertDateTimeInt(model.setDate.ToDateTime()).ToString();
            }
            if (model.id > 0)
            {
                //修改
                Entity.ResultEntity updateResult = _cServices.UpdateCompany(model);
                ShowMessageHelper.MessageBoxBackPage("单位信息修改成功");
            }
            else
            {
                //新建
                CompanyAdd entity = new CompanyAdd()
                {
                    unitName = model.unitName,
                    address  = model.address,
                    clientId = model.clientId,
                    cop      = model.cop,
                    fax      = model.fax,
                    tel1     = model.tel1,
                    tel2     = model.tel2,
                    typeId   = model.typeId,
                    gradeSid = model.gradeSid,
                    linkman  = model.linkman,
                    notused  = model.notused,
                    remark   = model.remark,
                    setDate  = model.setDate,
                    setMan   = model.setMan
                };

                ResultAddCompany addResult = _cServices.AddCompany(entity);
                if (addResult != null && addResult.result == "1")
                {
                    model.id     = addResult.id;
                    model.unitId = addResult.unitId;
                    ShowMessageHelper.MessageBoxBackPage("单位信息创建成功");
                }
                else
                {
                    ShowMessageHelper.MessageBoxBackPage("服务器异常,请稍后再试");
                }
            }
            LoadDropDownListData();
            return(View(model));
        }