/// <summary> /// 保存修改的数据 /// </summary> /// <returns>true:修改成功,false:修改失败</returns> private bool SaveEditData() { currentOrganizeEntity.ParentId = BusinessLogic.ConvertToString(txtParentId.SelectedValue); currentOrganizeEntity.FullName = txtFullName.Text.Trim(); currentOrganizeEntity.ShortName = txtShortName.Text.Trim(); currentOrganizeEntity.Code = txtCode.Text.Trim(); currentOrganizeEntity.Category = cboCategory.SelectedValue.ToString(); currentOrganizeEntity.ManagerId = txtManager.AccessibleDescription; currentOrganizeEntity.Manager = txtManager.Text.Trim(); currentOrganizeEntity.AssistantManagerId = txtAssistantManager.AccessibleDescription; currentOrganizeEntity.AssistantManager = txtAssistantManager.Text.Trim(); currentOrganizeEntity.OuterPhone = txtOuterPhone.Text.Trim(); currentOrganizeEntity.InnerPhone = txtInnerPhone.Text.Trim(); currentOrganizeEntity.Fax = txtFax.Text.Trim(); currentOrganizeEntity.Postalcode = txtPostalcode.Text.Trim(); currentOrganizeEntity.Web = txtWeb.Text.Trim(); currentOrganizeEntity.Address = txtAddress.Text.Trim(); currentOrganizeEntity.Enabled = chkEnabled.Checked ? 1 : 0; currentOrganizeEntity.IsInnerOrganize = chkIsInnerOrganize.Checked ? 1 : 0; currentOrganizeEntity.Description = txtDescription.Text.Trim(); if (base.UserInfo != null) { currentOrganizeEntity.ModifiedBy = base.UserInfo.RealName; currentOrganizeEntity.ModifiedUserId = base.UserInfo.Id; } int returnValue = 0; string statusMessage = string.Empty; try { returnValue = organizeService.Update(base.UserInfo, currentOrganizeEntity, out statusMessage); this.EntityId = currentOrganizeEntity.Id.ToString(); this.FullName = currentOrganizeEntity.FullName; this.ParentId = txtParentId.SelectedValue == null ? string.Empty : txtParentId.SelectedValue.ToString(); if (returnValue > 0) { if (SystemInfo.ShowSuccessMsg) { MessageBoxHelper.ShowSuccessMsg(RDIFrameworkMessage.MSG0011); } return(true); } else { MessageBoxHelper.ShowWarningMsg(statusMessage); return(false); } } catch (Exception ex) { base.ProcessException(ex); return(false); } }
public ActionResult Form(Sys_Organize model) { if (model.Id == null) { var primaryKey = _organizeService.Insert(model); return(primaryKey != null?Success() : Error()); } else { int row = _organizeService.Update(model); return(row > 0 ? Success() : Error()); } }
public ActionResult Edit(OrganizeDto model) { var resultModel = new RespResultCountViewModel(); #region 验证 if (string.IsNullOrEmpty(model.OrgName)) { resultModel.code = -1; resultModel.msg = "机构名称不允许为空!"; return(Ok(resultModel)); } if (string.IsNullOrEmpty(model.OrgCode)) { resultModel.code = -1; resultModel.msg = "机构代码不允许为空!"; return(Ok(resultModel)); } if (_organizeService.ExistFullName(model.OrgName, model.OrganizeId)) { resultModel.code = -1; resultModel.msg = "已存在相同机构名称!"; return(Ok(resultModel)); } if (_organizeService.ExistEnCode(model.OrgCode, model.OrganizeId)) { resultModel.code = -1; resultModel.msg = "已存在相同机构代码!"; return(Ok(resultModel)); } //if (string.IsNullOrEmpty(model.XAreaCode)) //{ // resultModel.code = -1; // resultModel.msg = "区划代码不能为空!"; // return Ok(resultModel); //} #endregion try { if (model.ParentId == null) { model.ParentId = "0"; } OrganizeEntity organizeEntity = _mapper.Map <OrganizeEntity>(model); organizeEntity.OrgBrevityCode = CommonHelper.GetPinyinCode(organizeEntity.OrgName); organizeEntity.ModifyDate = DateTime.Now; organizeEntity.ModifyUserId = User.GetCurrentUserId(); organizeEntity.ModifyUserName = User.GetCurrentUserName(); organizeEntity.ModifyDate = DateTime.Now; bool result = _organizeService.Update(organizeEntity); if (result) { resultModel.code = 0; resultModel.msg = "修改成功"; resultModel.data = null; } else { resultModel.code = -1; resultModel.msg = "修改失败"; resultModel.data = null; } return(Ok(resultModel)); } catch (Exception ex) { resultModel.code = -1; resultModel.msg = "操作失败:" + ex.Message; resultModel.data = null; return(Ok(resultModel)); } }
public Task <IResultModel> Update(OrganizeUpdateModel model) { return(_service.Update(model)); }