Пример #1
0
        private void SaveRecord()
        {
            Contacts clsContact = new Contacts();
            ContactDetails clsDetails = new ContactDetails();

            clsDetails.ContactID = Convert.ToInt32(lblContactID.Text);
            clsDetails.ContactCode = lblCustomerCode.Text;
            clsDetails.ContactName = txtLastName.Text + ", " + txtFirstName.Text + " " + txtMiddleName.Text;
            clsDetails.ContactGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value);
            clsDetails.ModeOfTerms = ModeOfTerms.Months;
            clsDetails.Terms = 0;
            clsDetails.Address = txtAddress1.Text + " " + txtAddress2.Text + " " + txtCity.Text + " " + txtState.Text + " " + txtZipCode.Text;
            clsDetails.BusinessName = txtBusinessName.Text;
            clsDetails.TelephoneNo = txtBusinessPhoneNo.Text;
            clsDetails.Remarks = txtRemarks.Text;
            clsDetails.Debit = 0;
            clsDetails.Credit = 0;
            clsDetails.IsCreditAllowed = false;
            clsDetails.CreditLimit = 0;
            clsDetails.DepartmentID = Convert.ToInt16(cboDepartment.SelectedItem.Value);
            clsDetails.PositionID = Convert.ToInt16(cboPosition.SelectedItem.Value);

            DateTime dteBirthDate = Constants.C_DATE_MIN_VALUE;
            DateTime dteSpouseBirthDate = Constants.C_DATE_MIN_VALUE;
            DateTime dteAnniversaryDate = Constants.C_DATE_MIN_VALUE;

            dteBirthDate = DateTime.TryParse(txtBirthDate.Text, out dteBirthDate) ? dteBirthDate : Constants.C_DATE_MIN_VALUE;
            dteSpouseBirthDate = DateTime.TryParse(txtSpouseBirthDate.Text, out dteSpouseBirthDate) ? dteSpouseBirthDate : Constants.C_DATE_MIN_VALUE;
            dteAnniversaryDate = DateTime.TryParse(txtAnniversaryDate.Text, out dteAnniversaryDate) ? dteAnniversaryDate : Constants.C_DATE_MIN_VALUE;

            ContactAddOnDetails clsAddOnDetails = new ContactAddOnDetails();
            clsAddOnDetails.ContactID = clsDetails.ContactID;
            clsAddOnDetails.Salutation = cboSalutation.SelectedItem.Value;
            clsAddOnDetails.FirstName = txtFirstName.Text;
            clsAddOnDetails.MiddleName = txtMiddleName.Text;
            clsAddOnDetails.LastName = txtLastName.Text;
            clsAddOnDetails.SpouseName = txtSpouseName.Text;
            clsAddOnDetails.BirthDate = dteBirthDate;
            clsAddOnDetails.SpouseBirthDate = dteSpouseBirthDate;
            clsAddOnDetails.AnniversaryDate = dteAnniversaryDate;
            clsAddOnDetails.Address1 = txtAddress1.Text;
            clsAddOnDetails.Address2 = txtAddress2.Text;
            clsAddOnDetails.City = txtCity.Text;
            clsAddOnDetails.State = txtState.Text;
            clsAddOnDetails.ZipCode = txtZipCode.Text;
            clsAddOnDetails.CountryID = int.Parse(cboCountry.SelectedItem.Value);
            clsAddOnDetails.CountryCode = cboCountry.SelectedItem.Text;
            clsAddOnDetails.BusinessPhoneNo = txtBusinessPhoneNo.Text;
            clsAddOnDetails.HomePhoneNo = txtHomePhoneNo.Text;
            clsAddOnDetails.MobileNo = txtMobileNo.Text;
            clsAddOnDetails.FaxNo = txtFaxNo.Text;
            clsAddOnDetails.EmailAddress = txtEmailAddress.Text;

            clsDetails.AdditionalDetails = clsAddOnDetails;

            clsContact.Update(clsDetails);

            clsContact.CommitAndDispose();
        }
Пример #2
0
        private void SaveRecord()
        {
            Contacts clsContact = new Contacts();
            ContactDetails clsDetails = new ContactDetails();

            clsDetails.ContactID = Convert.ToInt32(lblContactID.Text);
            clsDetails.ContactCode = txtContactCode.Text;
            clsDetails.ContactName = txtContactName.Text;
            clsDetails.ContactGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value);
            clsDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), cboModeOfTerms.SelectedItem.Value);
            clsDetails.Terms = Convert.ToInt32(txtTerms.Text);
            clsDetails.Address = txtAddress.Text;
            clsDetails.BusinessName = txtBusinessName.Text;
            clsDetails.TelephoneNo = txtTelephoneNo.Text;
            clsDetails.Remarks = txtRemarks.Text;
            clsDetails.Debit = Convert.ToDecimal(txtDebit.Text);
            clsDetails.Credit = Convert.ToDecimal(txtCredit.Text);
            clsDetails.IsCreditAllowed = chkIsCreditAllowed.Checked;
            //if (chkIsCreditAllowed.Checked == false)
            //    clsDetails.IsCreditAllowed = 0;
            //else
            //    clsDetails.IsCreditAllowed = 1;
            clsDetails.CreditLimit = Convert.ToDecimal(txtCreditLimit.Text);
            clsDetails.DepartmentID = Convert.ToInt16(cboDepartment.SelectedItem.Value);
            clsDetails.PositionID = Convert.ToInt16(cboPosition.SelectedItem.Value);

            clsContact.Update(clsDetails);

            clsContact.CommitAndDispose();
        }
Пример #3
0
        private void SaveRecord()
        {
            Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"];

            Contacts clsContact = new Contacts();
            ContactDetails clsDetails = new ContactDetails();

            clsDetails.ContactID = Convert.ToInt32(lblContactID.Text);
            clsDetails.ContactCode = txtContactCode.Text;
            clsDetails.ContactName = txtLastName.Text + ", " + txtFirstName.Text + " " + txtMiddleName.Text;
            clsDetails.ContactGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value);
            clsDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), cboModeOfTerms.SelectedItem.Value);
            clsDetails.Terms = Convert.ToInt32(txtTerms.Text);
            clsDetails.Address = txtAddress.Text;
            clsDetails.BusinessName = txtBusinessName.Text;
            clsDetails.TelephoneNo = txtTelephoneNo.Text;
            clsDetails.Remarks = txtRemarks.Text;
            clsDetails.Debit = Convert.ToDecimal(txtDebit.Text);
            clsDetails.Credit = Convert.ToDecimal(txtCredit.Text);
            clsDetails.IsCreditAllowed = chkIsCreditAllowed.Checked;
            clsDetails.CreditLimit = Convert.ToDecimal(txtCreditLimit.Text);
            clsDetails.DepartmentID = Convert.ToInt16(cboDepartment.SelectedItem.Value);
            clsDetails.PositionID = Convert.ToInt16(cboPosition.SelectedItem.Value);

            ContactAddOnDetails clsAddOnDetails = new ContactAddOnDetails();
            clsAddOnDetails.ContactID = clsDetails.ContactID;
            clsAddOnDetails.Salutation = cboSalutation.SelectedItem.Value;
            clsAddOnDetails.FirstName = txtFirstName.Text;
            clsAddOnDetails.MiddleName = txtMiddleName.Text;
            clsAddOnDetails.LastName = txtLastName.Text;
            clsAddOnDetails.SpouseName = "";
            DateTime dteBirthDate = Constants.C_DATE_MIN_VALUE;
            dteBirthDate = DateTime.TryParse(txtBirthDate.Text, out dteBirthDate) ? dteBirthDate : Constants.C_DATE_MIN_VALUE;
            clsAddOnDetails.BirthDate = dteBirthDate;
            clsAddOnDetails.SpouseBirthDate = Constants.C_DATE_MIN_VALUE;
            clsAddOnDetails.AnniversaryDate = Constants.C_DATE_MIN_VALUE;
            clsAddOnDetails.Address1 = txtAddress.Text;
            clsAddOnDetails.Address2 = string.Empty;
            clsAddOnDetails.City = string.Empty;
            clsAddOnDetails.State = string.Empty;
            clsAddOnDetails.ZipCode = string.Empty;
            clsAddOnDetails.CountryID = Constants.C_DEF_COUNTRY_ID;
            clsAddOnDetails.CountryCode = Constants.C_DEF_COUNTRY_CODE;
            clsAddOnDetails.BusinessPhoneNo = txtTelephoneNo.Text;
            clsAddOnDetails.HomePhoneNo = string.Empty;
            clsAddOnDetails.MobileNo = txtMobileNo.Text;
            clsAddOnDetails.FaxNo = string.Empty;
            clsAddOnDetails.EmailAddress = string.Empty;

            clsDetails.AdditionalDetails = clsAddOnDetails;

            clsContact.Update(clsDetails);
            clsContact.CommitAndDispose();
        }