Exemple #1
0
        private bool SaveData()
        {
            organizeEntity = null;
            organizeEntity = new PiOrganizeEntity
            {
                ParentId           = BusinessLogic.ConvertToString(txtParentId.SelectedValue),
                Code               = txtCode.Text.Trim(),
                ShortName          = txtShortName.Text.Trim(),
                FullName           = txtFullName.Text.Trim(),
                Category           = cboCategory.SelectedValue.ToString(),
                OuterPhone         = txtOuterPhone.Text.Trim(),
                InnerPhone         = txtInnerPhone.Text.Trim(),
                Fax                = txtFax.Text.Trim(),
                Postalcode         = txtPostalcode.Text.Trim(),
                Address            = txtAddress.Text.Trim(),
                Web                = txtWeb.Text.Trim(),
                ManagerId          = txtManager.AccessibleDescription,
                Manager            = txtManager.Text.Trim(),
                AssistantManagerId = txtAssistantManager.AccessibleDescription,
                AssistantManager   = txtAssistantManager.Text.Trim(),
                IsInnerOrganize    = chkIsInnerOrganize.Checked ? 1 : 0,
                Enabled            = chkEnabled.Checked ? 1 : 0,
                DeleteMark         = 0,
                Description        = txtDescription.Text.Trim()
            };

            if (base.UserInfo != null)
            {
                organizeEntity.CreateBy     = UserInfo.RealName;
                organizeEntity.CreateUserId = UserInfo.Id;
            }

            string statusMessage = string.Empty;
            string statusCode    = string.Empty;

            try
            {
                this.EntityId = organizeService.Add(base.UserInfo, organizeEntity, out statusCode, out statusMessage);
                this.FullName = organizeEntity.FullName;
                this.ParentId = txtParentId.SelectedValue.ToString();
                if (statusCode == StatusCode.OKAdd.ToString())
                {
                    if (SystemInfo.ShowSuccessMsg)
                    {
                        MessageBoxHelper.ShowSuccessMsg(RDIFrameworkMessage.MSG0011);
                    }
                    return(true);
                }
                else
                {
                    MessageBoxHelper.ShowWarningMsg(statusMessage);
                    if (statusCode == StatusCode.ErrorNameExist.ToString())
                    {
                        this.txtFullName.SelectAll();
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                base.ProcessException(ex);
                return(false);
            }
        }
Exemple #2
0
 public Task <IResultModel> Add(OrganizeAddModel model)
 {
     return(_service.Add(model));
 }