private void SaveSingleCustomerData(CustMan.Customer currentCustomer)
        {
            currentCustomer.CustomerName = txtCustomerName.Value.ToString();

            if (cmbCar.SelectedItem != null && cmbCar.SelectedItem.Value != null && cmbCar.SelectedItem.Value.ToString() != string.Empty)
            {
                currentCustomer.Car = cmbCar.SelectedItem.Value.ToString();
            }
            else
            {
                currentCustomer.Car = null;
            }

            currentCustomer.CarLicensePlate = txtLicensePlate.Value == null ? string.Empty : txtLicensePlate.Value.ToString();
            currentCustomer.CCExpirationDate = CCExpiryDate;
            currentCustomer.CCNameOnCard = txtNameOnCard.Value == null ? string.Empty : txtNameOnCard.Value.ToString();
            currentCustomer.CCNo = txtCCNumber.Value == null ? string.Empty : txtCCNumber.Value.ToString();
            currentCustomer.CardSecurityCode = txtCardSecurityCode.Value == null ? string.Empty : txtCardSecurityCode.Value.ToString();

            if (dtStartDate.Value == null || dtStartDate.Value.ToString() == string.Empty)
            {
                currentCustomer.CardStartDate = null;
            }
            else
            {
                currentCustomer.CardStartDate = Convert.ToDateTime(dtStartDate.Value.ToString());
            }

            currentCustomer.CardIssueNo = txtCardIssueNo.Value == null ? string.Empty : txtCardIssueNo.Value.ToString();

            if (cmbCCType.SelectedItem != null && cmbCCType.SelectedItem.Value != null && cmbCCType.SelectedItem.Value.ToString() != string.Empty)
            {
                currentCustomer.CreditCardTypeId = Convert.ToInt32(cmbCCType.SelectedItem.Value.ToString());
            }
            else
            {
                currentCustomer.CreditCardTypeId = null;
            }

            currentCustomer.CompanyName = txtCompanyName.Value == null ? string.Empty : txtCompanyName.Value.ToString();
            currentCustomer.CompanyNotes = txtNotes.Value == null ? string.Empty : txtNotes.Value.ToString();

            currentCustomer.UseSameBillingAddress = chkUseSameBillingAddress.Checked == true ? true : false;

            if (chkUseSameBillingAddress.Checked)
            {
                currentCustomer.CompanyAddressLine1 = string.Empty;
                currentCustomer.CompanyAddressLine2 = string.Empty;
                currentCustomer.CompanyCity = string.Empty;
                currentCustomer.CompanyCountryId = null;
                currentCustomer.CompanyState = string.Empty;
                currentCustomer.CompanyPostCode = string.Empty;
            }
            else
            {
                currentCustomer.CompanyAddressLine1 = txtCompanyAddressLine1.Value == null ? string.Empty : txtCompanyAddressLine1.Value.ToString();
                currentCustomer.CompanyAddressLine2 = txtCompanyAddressLine2.Value == null ? string.Empty : txtCompanyAddressLine2.Value.ToString();
                currentCustomer.CompanyCity = txtCompanyCity.Text.Trim();

                if (cmbCompanyCountry.SelectedItem != null && cmbCompanyCountry.SelectedItem.Value != null && cmbCompanyCountry.SelectedItem.Value.ToString() != string.Empty)
                {
                    currentCustomer.CompanyCountryId = Convert.ToInt32(cmbCompanyCountry.SelectedItem.Value.ToString());
                }
                else
                {
                    currentCustomer.CompanyCountryId = null;
                }

                currentCustomer.CompanyState = txtCompanyState.Value == null ? string.Empty : txtCompanyState.Value.ToString();
                currentCustomer.CompanyPostCode = txtCompanyPostCode.Value == null ? string.Empty : txtCompanyPostCode.Value.ToString();
            }

            currentCustomer.BillingAddressLine1 = txtBillingAddressLine1.Value == null ? string.Empty : txtBillingAddressLine1.Value.ToString();
            currentCustomer.BillingAddressLine2 = txtBillingAddressLine2.Value == null ? string.Empty : txtBillingAddressLine2.Value.ToString();
            currentCustomer.BillingCity = txtBillingCity.Value.ToString();
            currentCustomer.BillingState = txtBillingState.Value == null ? string.Empty : txtBillingState.Value.ToString();

            if (cmbBillingCountry.SelectedItem != null && cmbBillingCountry.SelectedItem.Value != null && cmbBillingCountry.SelectedItem.Value.ToString() != string.Empty)
            {
                currentCustomer.BillingCountryId = Convert.ToInt32(cmbBillingCountry.SelectedItem.Value);
            }
            else
            {
                currentCustomer.BillingCountryId = null;
            }

            currentCustomer.BillingPostCode = txtBillingPostCode.Value == null ? string.Empty : txtBillingPostCode.Value.ToString();

            currentCustomer.DriverLicense = txtDriveLicense.Value == null ? string.Empty : txtDriveLicense.Value.ToString();
            currentCustomer.Email = txtEmail.Value == null ? string.Empty : txtEmail.Value.ToString();
            currentCustomer.Fax = txtFax.Value == null ? string.Empty : txtFax.Value.ToString();
            currentCustomer.Gender = cmbGender.SelectedItem == null ? string.Empty : cmbGender.SelectedItem.Value.ToString();
            currentCustomer.MemberCode = txtMemberCode.Value == null ? string.Empty : txtMemberCode.Value.ToString();
            currentCustomer.Mobile = txtPhone.Value == null ? string.Empty : txtPhone.Value.ToString();

            if (cmbGuestType.SelectedItem != null)
            {
                currentCustomer.GuestTypeId = (int)cmbGuestType.SelectedItem.Value;
            }

            if (cmbPassportCountryOfIssue.SelectedItem != null && cmbPassportCountryOfIssue.SelectedItem.Value != null && cmbPassportCountryOfIssue.SelectedItem.Value.ToString() != string.Empty)
            {
                currentCustomer.PassportCountryOfIssue = Convert.ToInt32(cmbPassportCountryOfIssue.SelectedItem.Value);
            }
            else
            {
                currentCustomer.PassportCountryOfIssue = null;
            }

            if (dtpExpiryDate.Value != null)
            {
                currentCustomer.PassportExpirationDate = (DateTime?)dtpExpiryDate.Value;
            }
            currentCustomer.PassportNumber = txtPassportNumber.Value == null ? string.Empty :  txtPassportNumber.Value.ToString();
            currentCustomer.Phone = txtPhone.Value==null ? string.Empty : txtPhone.Value.ToString();
            currentCustomer.CreatedUser = Master.LoggedUser.UsersId;
            currentCustomer.UpdatedUser = Master.LoggedUser.UsersId;
            currentCustomer.StatusId = (int)HBM.Common.Enums.HBMStatus.Active;
        }
        private void LoadIndividualCustomers(CustMan.Customer CustomerObj)
        {
            hdnCustomerMode.Value = ((int)Common.Enums.CustomerModes.Individual).ToString();
            rblCustomerMode.SelectedValue = ((int)Common.Enums.CustomerModes.Individual).ToString();
            tblIndividualCustomer.Visible = true;
            tblGroupCustomer.Visible = false;

            chkUseSameBillingAddress.Checked = CustomerObj.UseSameBillingAddress;

            if (CustomerObj.UseSameBillingAddress)
            {
                txtCompanyAddressLine1.Enabled = false;
                txtCompanyAddressLine2.Enabled = false;
                txtCompanyState.Enabled = false;
                cmbCompanyCountry.Enabled = false;
                txtCompanyPostCode.Enabled = false;
                txtCompanyCity.Enabled = false;
            }
            else
            {
                txtCompanyAddressLine1.Enabled = true;
                txtCompanyAddressLine2.Enabled = true;
                txtCompanyState.Enabled = true;
                cmbCompanyCountry.Enabled = true;
                txtCompanyPostCode.Enabled = true;
                txtCompanyCity.Enabled = true;
            }

            txtCustomerName.Text = CustomerObj.CustomerName;
            txtBillingAddressLine1.Text = CustomerObj.BillingAddressLine1;
            txtBillingAddressLine2.Text = CustomerObj.BillingAddressLine2;

            txtBillingCity.Text = CustomerObj.BillingCity;

            if (CustomerObj.BillingCountryId.HasValue)
            {
                cmbBillingCountry.Value = CustomerObj.BillingCountryId;
            }

            txtBillingPostCode.Text = CustomerObj.BillingPostCode;
            txtBillingState.Text = CustomerObj.BillingState;

            if (string.IsNullOrEmpty(CustomerObj.Car) == false)
            {
                cmbCar.Text = CustomerObj.Car;

            }

            txtLicensePlate.Text = CustomerObj.CarLicensePlate;
            CCExpiryDate = CustomerObj.CCExpirationDate;
            txtNameOnCard.Text = CustomerObj.CCNameOnCard;
            txtCCNumber.Text = string.IsNullOrEmpty(CustomerObj.CCNo) ? string.Empty : CustomerObj.CCNo.ToString();
            txtCardSecurityCode.Text = CustomerObj.CardSecurityCode;

            if (CustomerObj.CardStartDate == null)
            {
                dtStartDate.Text = string.Empty;
            }
            else
            {
                dtStartDate.Value = CustomerObj.CardStartDate;
            }

            txtCardIssueNo.Text = CustomerObj.CardIssueNo;

            if (CustomerObj.CreditCardTypeId.HasValue)
            {
                cmbCCType.Value = CustomerObj.CreditCardTypeId.Value;
            }

            txtCompanyAddressLine1.Text = CustomerObj.CompanyAddressLine1;
            txtCompanyAddressLine2.Text = CustomerObj.CompanyAddressLine2;
            txtCompanyCity.Text = CustomerObj.CompanyCity;
            if (CustomerObj.CompanyCountryId.HasValue)
                cmbCompanyCountry.Value = CustomerObj.CompanyCountryId;
            txtCompanyState.Text = CustomerObj.CompanyState;
            txtCompanyPostCode.Text = CustomerObj.CompanyPostCode;

            txtCompanyName.Text = CustomerObj.CompanyName;
            txtNotes.Text = CustomerObj.CompanyNotes;
            txtDriveLicense.Text = CustomerObj.DriverLicense;
            txtEmail.Text = CustomerObj.Email;
            txtFax.Text = CustomerObj.Fax;

            if (CustomerObj.GuestTypeId > 0)
            {
                cmbGuestType.Value = CustomerObj.GuestTypeId;
            }

            if (string.IsNullOrEmpty(CustomerObj.Gender) == false)
            {
                cmbGender.Value = CustomerObj.Gender;
            }

            txtMemberCode.Text = CustomerObj.MemberCode;

            if (CustomerObj.PassportCountryOfIssue.HasValue)
            {
                cmbPassportCountryOfIssue.Value = CustomerObj.PassportCountryOfIssue;
            }

            if (CustomerObj.PassportExpirationDate.HasValue)
            {
                dtpExpiryDate.Date = CustomerObj.PassportExpirationDate.Value;
            }

            txtPassportNumber.Text = CustomerObj.PassportNumber;
            txtPhone.Text = CustomerObj.Phone;

            rblCustomerMode.Enabled = false;
        }
        private void SaveCustomerGroupData(CustMan.Customer currentCustomer)
        {
            currentCustomer.CustomerName = txtGroupName.Value.ToString();

            currentCustomer.Car = null;
            currentCustomer.CarLicensePlate = null;

            currentCustomer.CCExpirationDate = CCExpiryDateGrp;
            currentCustomer.CCNameOnCard = txtNameOnCardGrp.Text.ToString();
            currentCustomer.CCNo = txtCCNoGrp.Text.ToString();
            currentCustomer.CardSecurityCode = txtCardSecurityCodeGrp.Text.ToString();

            if (dtStartDateGrp.Value == null)
            {
                currentCustomer.CardStartDate = null;
            }
            else
            {
                if (dtStartDateGrp.Value == null && dtStartDateGrp.Value.ToString() == string.Empty)
                {
                    currentCustomer.CardStartDate = null;
                }
                else
                {
                    currentCustomer.CardStartDate = Convert.ToDateTime(dtStartDateGrp.Value.ToString());
                }
            }

            currentCustomer.CardIssueNo = txtCardIssueNoGrp.Text.ToString();

            if (cmbCCTypeGrp.SelectedItem == null)
            {
                currentCustomer.CreditCardTypeId = null;
            }
            else
            {
                if (cmbCCTypeGrp.SelectedItem.Value != null && cmbCCTypeGrp.SelectedItem.Value.ToString() != string.Empty)
                {
                    currentCustomer.CreditCardTypeId = Convert.ToInt32(cmbCCTypeGrp.SelectedItem.Value.ToString());
                }
                else
                {
                    currentCustomer.CreditCardTypeId = null;
                }
            }

            currentCustomer.CompanyName = txtCompanyNameGrp.Text.ToString();
            currentCustomer.CompanyNotes = txtCompanyNotesGrp.Text.ToString();

            currentCustomer.UseSameBillingAddress = chkUseSameBillingAddressGrp.Checked == true ? true : false;

            if (chkUseSameBillingAddressGrp.Checked)
            {
                currentCustomer.CompanyAddressLine1 = string.Empty;
                currentCustomer.CompanyAddressLine2 = string.Empty;
                currentCustomer.CompanyCity = string.Empty;
                currentCustomer.CompanyCountryId = null;
                currentCustomer.CompanyState = string.Empty;
                currentCustomer.CompanyPostCode = string.Empty;
            }
            else
            {
                currentCustomer.CompanyAddressLine1 = txtCompanyAddressLine1Grp.Text.ToString();
                currentCustomer.CompanyAddressLine2 = txtCompanyAddressLine2Grp.Text.ToString();
                currentCustomer.CompanyCity = txtCompanyCityGrp.Text.Trim();

                if (cmbCompanyCountryGrp.Items == null || cmbCompanyCountryGrp.SelectedItem == null)
                {
                    currentCustomer.CompanyCountryId = null;
                }
                else
                {
                    if (cmbCompanyCountryGrp.SelectedItem.Value != null && cmbCompanyCountryGrp.SelectedItem.Value.ToString() != string.Empty)
                    {
                        currentCustomer.CompanyCountryId = Convert.ToInt32(cmbCompanyCountryGrp.SelectedItem.Value.ToString());
                    }
                    else
                    {
                        currentCustomer.CompanyCountryId = null;
                    }
                }

                currentCustomer.CompanyState = txtCompanyStateGrp.Text.ToString();
                currentCustomer.CompanyPostCode = txtCompanyPostCodeGrp.Text.ToString();
            }

            currentCustomer.BillingAddressLine1 = txtBillingAddressLine1Grp.Text.ToString();
            currentCustomer.BillingAddressLine2 = txtBillingAddressLine2Grp.Text.ToString();
            currentCustomer.BillingCity = txtBillingCityGrp.Text.ToString();
            currentCustomer.BillingState = txtBillingStateGrp.Text.ToString();

            if (cmbBillingCountryGrp.Items == null || cmbBillingCountryGrp.SelectedItem == null)
            {
                currentCustomer.BillingCountryId = null;
            }
            else
            {
                if (cmbBillingCountryGrp.SelectedItem.Value != null && cmbBillingCountryGrp.SelectedItem.Value.ToString() != string.Empty)
                {
                    currentCustomer.BillingCountryId = Convert.ToInt32(cmbBillingCountryGrp.SelectedItem.Value);
                }
                else
                {
                    currentCustomer.BillingCountryId = null;
                }
            }

            currentCustomer.BillingPostCode = txtBillingZipPostalCodeGrp.Text.ToString();

            currentCustomer.DriverLicense = null;
            currentCustomer.Email = txtEmailGrp.Text.ToString();
            currentCustomer.Fax = txtFaxGrp.Text.ToString();
            currentCustomer.Gender = "Male";
            currentCustomer.MemberCode = txtMemberCodeGrp.Text.ToString();
            currentCustomer.Mobile = txtPhoneGrp.Text.ToString();
            currentCustomer.GuestTypeId = (int)cmbGuestTypeGrp.SelectedItem.Value;
            currentCustomer.PassportCountryOfIssue = null;

            currentCustomer.Phone = txtPhoneGrp.Text.ToString();
            currentCustomer.CreatedUser = Master.LoggedUser.UsersId;
            currentCustomer.UpdatedUser = Master.LoggedUser.UsersId;
            currentCustomer.StatusId = (int)HBM.Common.Enums.HBMStatus.Active;
            currentCustomer.IsGroupCustomer = true;
            currentCustomer.DsGroupCustomers = (DataSet)Session[Constants.SESSION_GROUPCUSTOMERS];
        }
        private void LoadGroupCustomers(CustMan.Customer CustomerObj)
        {
            hdnCustomerMode.Value = ((int)Common.Enums.CustomerModes.Group).ToString();
            rblCustomerMode.SelectedValue = ((int)Common.Enums.CustomerModes.Group).ToString();

            chkUseSameBillingAddressGrp.Checked = CustomerObj.UseSameBillingAddress;

            tblIndividualCustomer.Visible = false;
            tblGroupCustomer.Visible = true;

            if (CustomerObj.UseSameBillingAddress)
            {
                txtCompanyAddressLine1Grp.Enabled = false;
                txtCompanyAddressLine2Grp.Enabled = false;
                txtCompanyStateGrp.Enabled = false;
                cmbCompanyCountryGrp.Enabled = false;
                txtCompanyPostCodeGrp.Enabled = false;
                txtCompanyCityGrp.Enabled = false;
            }
            else
            {
                txtCompanyAddressLine1Grp.Enabled = true;
                txtCompanyAddressLine2Grp.Enabled = true;
                txtCompanyStateGrp.Enabled = true;
                cmbCompanyCountryGrp.Enabled = true;
                txtCompanyPostCodeGrp.Enabled = true;
                txtCompanyCityGrp.Enabled = true;
            }

            txtGroupName.Text = CustomerObj.CustomerName;
            txtBillingAddressLine1Grp.Text = CustomerObj.BillingAddressLine1;
            txtBillingAddressLine2Grp.Text = CustomerObj.BillingAddressLine2;

            txtBillingCityGrp.Text = CustomerObj.BillingCity;

            if (CustomerObj.BillingCountryId.HasValue)
            {
                cmbBillingCountryGrp.Value = CustomerObj.BillingCountryId;
            }

            txtBillingZipPostalCodeGrp.Text = CustomerObj.BillingPostCode;
            txtBillingStateGrp.Text = CustomerObj.BillingState;

            CCExpiryDateGrp = CustomerObj.CCExpirationDate;
            txtNameOnCardGrp.Text = CustomerObj.CCNameOnCard;
            txtCCNoGrp.Text = string.IsNullOrEmpty(CustomerObj.CCNo) ? string.Empty : CustomerObj.CCNo.ToString();
            txtCardSecurityCodeGrp.Text = CustomerObj.CardSecurityCode;

            if (CustomerObj.CardStartDate == null)
            {
                dtStartDateGrp.Text = string.Empty;
            }
            else
            {
                dtStartDateGrp.Value = CustomerObj.CardStartDate;
            }

            txtCardIssueNoGrp.Text = CustomerObj.CardIssueNo;

            if (CustomerObj.CreditCardTypeId.HasValue)
            {
                cmbCCTypeGrp.Value = CustomerObj.CreditCardTypeId.Value;
            }

            txtCompanyAddressLine1Grp.Text = CustomerObj.CompanyAddressLine1;
            txtCompanyAddressLine2Grp.Text = CustomerObj.CompanyAddressLine2;
            txtCompanyCityGrp.Text = CustomerObj.CompanyCity;
            if (CustomerObj.CompanyCountryId.HasValue)
                cmbCompanyCountryGrp.Value = CustomerObj.CompanyCountryId;
            txtCompanyStateGrp.Text = CustomerObj.CompanyState;
            txtCompanyPostCodeGrp.Text = CustomerObj.CompanyPostCode;

            txtCompanyNameGrp.Text = CustomerObj.CompanyName;
            txtCompanyNotesGrp.Text = CustomerObj.CompanyNotes;
            txtEmailGrp.Text = CustomerObj.Email;
            txtFaxGrp.Text = CustomerObj.Fax;

            if (CustomerObj.GuestTypeId > 0)
            {
                cmbGuestTypeGrp.Value = CustomerObj.GuestTypeId;
            }

            txtMemberCodeGrp.Text = CustomerObj.MemberCode;
            txtPhoneGrp.Text = CustomerObj.Phone;

            //Load the grid
            gvGroupMembers.DataSource = CustomerObj.DsGroupCustomers;
            gvGroupMembers.DataBind();
            dsData = CustomerObj.DsGroupCustomers;
            Session[Constants.SESSION_GROUPCUSTOMERS] = dsData;
            dsData.Tables[0].PrimaryKey = new DataColumn[] { dsData.Tables[0].Columns["CustomerId"] };
            rblCustomerMode.Enabled = false;
        }