Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                cblMembershipType.DataSource     = PackageService.GetAll();
                cblMembershipType.DataTextField  = "Name";
                cblMembershipType.DataValueField = "ID";
                cblMembershipType.DataBind();

                cblCustomerStatus.DataSource     = CustomerStatusService.GetAll();
                cblCustomerStatus.DataTextField  = "Description";
                cblCustomerStatus.DataValueField = "ID";
                cblCustomerStatus.DataBind();

                DynamicControlBinding.BindDropDown(ddlBillingType, BillingTypeService.GetActiveBillingTypes().Where(bt => bt.ID > 1), "Description", "ID", false);
                DynamicControlBinding.BindDropDown(ddlBranch, BranchService.GetActiveBranches(User.Identity.Name), "Name", "ID", false);

                ddlBranch.Enabled = false;

                calFindDateFrom.SelectedDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
                calFindDateTo.SelectedDate   = DateTime.Today;
                cblMembershipType.Items.Cast <ListItem>().ToList().ForEach(item => item.Selected = true);
            }
        }
Esempio n. 2
0
        private void LoadData(int customerID)
        {
            Customer cust = CustomerService.Get(customerID);

            txtBarcode.ReadOnly          = true;
            txtFirstName.Text            = cust.FirstName;
            txtLastName.Text             = cust.LastName;
            txtBarcode.Text              = cust.Barcode;
            txtAddress.Text              = cust.Address;
            ddlBillingType.SelectedValue = cust.BillingTypeID.ToString();
            txtCardNo.Text         = cust.CardNo;
            txtCardHolderName.Text = cust.CardHolderName;
            txtCardHolderID.Text   = cust.CardHolderID;
            if (cust.BankID.HasValue)
            {
                ddlBank.SelectedValue = cust.BankID.ToString();
            }

            if (cust.ExpiredDate.HasValue)
            {
                calExpiredDate.SelectedDate = cust.ExpiredDate.Value;
            }
            calDate.SelectedDate = cust.DateOfBirth.HasValue ? cust.DateOfBirth.Value : DateTime.Today;
            txtEmail.Text        = cust.Email;
            txtPhone.Text        = cust.HomePhone;
            txtCellPhone.Text    = cust.CellPhone1;
            txtCellPhone2.Text   = cust.CellPhone2;
            txtWorkPhone.Text    = cust.WorkPhone;
            txtZipCode.Text      = cust.ZipCode;
            txtIDCardNo.Text     = cust.IDCardNo;
            if (cust.OccupationID.HasValue)
            {
                ddlOccupation.SelectedValue = Convert.ToString(cust.OccupationID);
            }
            else
            {
                ddlOccupation.SelectedIndex = 0;
            }
            txtMailingAddress.Text = cust.MailingAddress;
            txtMailingZipCode.Text = cust.MailingZipCode;
            txtPartner.Text        = cust.Customer1 == null ? String.Empty : cust.Customer1.Barcode;
            if (cust.CreditCardTypeID.HasValue)
            {
                ddlCreditCardType.SelectedValue = cust.CreditCardTypeID.ToString();
            }
            if (cust.AreaID.HasValue)
            {
                ddlArea.SelectedValue = cust.AreaID.ToString();
            }
            else
            {
                ddlArea.SelectedIndex = 0;
            }
            lblHomeBranch.Text = cust.Branch.Name;
            ViewState["Photo"] = cust.Photo;


            RefreshActiveContracts(cust.Barcode);

            CustomerStatusHistory customerStatus = CustomerStatusService.GetLatestStatus(cust.Barcode);

            lblStatus.Text      = customerStatus == null ? "OK" : customerStatus.CustomerStatus.Description;
            lblStatusNotes.Text = customerStatus == null ? String.Empty : customerStatus.Notes;

            if (!String.IsNullOrEmpty(cust.Photo))
            {
                FileInfo file = new FileInfo(cust.Photo);
                imgPhoto.ImageUrl = ConfigurationManager.AppSettings[ApplicationSettingKeys.FolderPhotoCustomers] + @"\" + file.Name.Substring(0, file.Name.IndexOf(".")) + file.Extension + ".ashx?w=200";
            }
            else
            {
                imgPhoto.ImageUrl = ConfigurationManager.AppSettings[ApplicationSettingKeys.FolderPhotoCustomers] + @"\default.png";
            }
            chkDeletePhoto.Checked = false;

            hypParent.Attributes["onclick"]            = String.Format("window.open('MasterParents.aspx?CustomerCode={0}', 'Parent', 'width=800,height=500,location=no,resizable=yes')", txtBarcode.Text);
            hypViewStatusHistory.Attributes["onclick"] = String.Format("window.open('ViewCustomerStatusHistory.aspx?CustomerCode={0}', 'Parent', 'width=1100,height=500,location=no,resizable=yes')", txtBarcode.Text);

            gvwParents.DataBind();

            txtCardHolderID.ReadOnly = txtCardHolderName.ReadOnly = txtCardNo.ReadOnly = Convert.ToInt32(ddlBillingType.SelectedValue) == 3;
            calExpiredDate.Enabled   = ddlBank.Enabled = ddlCreditCardType.Enabled = !txtCardNo.ReadOnly;

            txtBarcode.Focus();
        }