コード例 #1
0
        private void SaveData(bool close)
        {
            if (CheckValueIsEmpty())
            {
                // 设置鼠标繁忙状态,并保留原先的状态
                Cursor holdCursor = this.Cursor;
                this.Cursor = Cursors.WaitCursor;
                var customerEntity = new CustomerEntity
                {
                    Code            = BusinessLogic.NewGuid(),
                    CustomerClassID = BusinessLogic.ConvertToInt(CurrentEntityId),
                    FullName        = txtFullName.Text.Trim(),
                    ShortName       = txtShortName.Text.Trim(),
                    CompanyName     = txtCompanyName.Text.Trim(),
                    Satisfy         = string.IsNullOrEmpty(cboSatisfy.SelectedValue.ToString())
                            ? 3
                            : BusinessLogic.ConvertToInt(cboSatisfy.SelectedValue),
                    Credit = string.IsNullOrEmpty(cboCredit.SelectedValue.ToString())
                            ? 3
                            : BusinessLogic.ConvertToInt(cboCredit.SelectedValue),
                    CompanyAddress = txtCompanyAddress.Text.Trim(),
                    PostalCode     = txtPostalCode.Text.Trim(),
                    CompanyPhone   = txtCompanyPhone.Text.Trim(),
                    CompanyFax     = txtCompanyFax.Text.Trim(),
                    WebAddress     = txtWebAddress.Text.Trim(),
                    EstablishDate  = BusinessLogic.ConvertToDateTime(dtEstablishDate.Text),
                    LicenceNo      = txtLicenceNo.Text.Trim(),
                    Chieftain      = txtChieftain.Text.Trim(),
                    Bankroll       = BusinessLogic.ConvertToInt(txtBankroll.Text.Trim()),
                    Turnover       = BusinessLogic.ConvertToInt(txtTurnover.Text.Trim()),
                    Bank           = txtBank.Text.Trim(),
                    BankAccount    = txtBankAccount.Text.Trim(),
                    LocalTaxNo     = txtLocalTaxNo.Text.Trim(),
                    NationalTaxNo  = txtNationalTaxNo.Text.Trim(),
                    Status         = string.IsNullOrEmpty(cboStatus.SelectedValue.ToString())
                            ? 1
                            : BusinessLogic.ConvertToInt(cboStatus.SelectedValue),
                    Description = txtDescription.Text.Trim()
                };

                string statusCode    = string.Empty;
                string statusMessage = string.Empty;
                string customerId    = customerService.Add(base.UserInfo, customerEntity, out statusCode, out statusMessage);
                string information   = statusMessage;
                if (customerId.Length > 0)
                {
                    this.Changed = true;
                    LinkManEntity linkMainEntity = new LinkManEntity
                    {
                        CustomerId  = BusinessLogic.ConvertToInt(customerId),
                        MainLinkMan = 1,
                        Name        = txtName.Text.Trim(),
                        Department  = txtDepartment.Text.Trim(),
                        Postion     = cboPostion.SelectedValue.ToString(),
                        Sex         = cboSex.SelectedValue.ToString(),
                        MobilePhone = txtMobilePhone.Text.Trim(),
                        Email       = txtEmail.Text.Trim(),
                        QQ          = txtQQ.Text.Trim(),
                        Interest    = txtInterest.Text.Trim()
                    };
                    string value = linkMainService.Add(base.UserInfo, linkMainEntity, out statusCode, out statusMessage);
                    if (value.Length <= 0)
                    {
                        information += "\n主联系人" + statusMessage;
                    }
                }

                MessageBoxHelper.ShowInformationMsg(information);

                // 设置鼠标默认状态,原来的光标状态
                this.Cursor = holdCursor;

                if (this.Changed && close)
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
        }
コード例 #2
0
        private void SaveData(bool close)
        {
            if (string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                MessageBoxHelper.ShowWarningMsg(txtName.Tag.ToString() + "不能为空!");
                txtName.Focus();
                return;
            }

            // 设置鼠标繁忙状态,并保留原先的状态
            Cursor holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;

            LinkManEntity linkManEntity = new LinkManEntity
            {
                CustomerId            = BusinessLogic.ConvertToInt(currentCustomerId),
                Name                  = txtName.Text.Trim(),
                MainLinkMan           = chkMainLinkMan.Checked ? 1 : 0,
                Sex                   = cboSex.SelectedValue.ToString(),
                Postion               = cboPostion.SelectedValue.ToString(),
                Department            = txtDepartment.Text.Trim(),
                MobilePhone           = txtMobilePhone.Text.Trim(),
                Telephone             = txtTelephone.Text.Trim(),
                HomePhone             = txtHomePhone.Text.Trim(),
                OfficeFax             = txtOfficeFax.Text.Trim(),
                IDCard                = txtIDCard.Text.Trim(),
                OfficeAddress         = txtOfficeAddress.Text.Trim(),
                QQ                    = txtQQ.Text.Trim(),
                Email                 = txtEmail.Text.Trim(),
                Interest              = txtInterest.Text.Trim(),
                Description           = txtDescription.Text.Trim(),
                Major                 = txtMajor.Text.Trim(),
                School                = txtSchool.Text.Trim(),
                EducationalBackground = cboEducationalBackground.SelectedValue.ToString(),
                Degree                = cboDegree.SelectedValue.ToString(),
                HomeZipCode           = txtHomeZipCode.Text.Trim(),
                HomeFax               = txtHomeFax.Text.Trim(),
                HomeAddress           = txtHomeAddress.Text.Trim(),
                NativePlace           = txtNativePlace.Text.Trim(),
                Party                 = cboParty.SelectedValue.ToString(),
                Nation                = txtNation.Text.Trim(),
                Nationality           = txtNationality.Text.Trim(),
                BloodType             = cboBloodType.SelectedValue.ToString(),
                BirthdayType          = 1
            };

            if (radLunarCalendar.Checked)
            {
                linkManEntity.BirthdayType = 2; //农历生日
            }
            linkManEntity.Birthday = BusinessLogic.ConvertToDateTime(dtBirthday.Text);
            string statusCode    = string.Empty;
            string statusMessage = string.Empty;
            string linkManId     = linkMainService.Add(base.UserInfo, linkManEntity, out statusCode, out statusMessage);

            if (linkManId.Trim().Length > 0)
            {
                this.Changed = true;
            }
            MessageBoxHelper.ShowInformationMsg(statusMessage);
            // 设置鼠标默认状态,原来的光标状态
            this.Cursor = holdCursor;

            if (this.Changed && close)
            {
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
        }