Example #1
0
        protected void GetCustomerById(string customerId)
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                DataTable dt = customer.GetCustomerById(customerId);

                if (dt.Rows.Count > 0)
                {
                    customerNameLabel.Text = dt.Rows[0]["CustomerName"].ToString();
                    //countryLabel.Text = dt.Rows[0]["Country"].ToString();
                    //cityLabel.Text = dt.Rows[0]["City"].ToString();
                    //districtLabel.Text = dt.Rows[0]["District"].ToString();
                    //postalCodeLabel.Text = dt.Rows[0]["PostalCode"].ToString();
                    //nationalIdLabel.Text = dt.Rows[0]["NationalId"].ToString();
                    //passportNumberLabel.Text = dt.Rows[0]["PassportNumber"].ToString();
                    contactNumberLabel.Text = dt.Rows[0]["ContactNumber"].ToString();
                    emailLabel.Text = dt.Rows[0]["Email"].ToString();
                    addressLabel.Text = dt.Rows[0]["Address"].ToString();
                    joiningSalesCenterLabel.Text = dt.Rows[0]["JoiningSalesCenterName"].ToString();
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Customer Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                customer = null;
            }
        }
        private void getCustomerByCustomerId()
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                DataTable dt = customer.GetCustomerById(customerIdDropDownList.SelectedValue);
                customerNameTextBox.Text = dt.Rows[0]["CustomerName"].ToString();
                customerContactNumberTextBox.Text = dt.Rows[0]["ContactNumber"].ToString();
                customerAddressTextBox.Text = dt.Rows[0]["Address"].ToString();
                if (!string.IsNullOrEmpty(customerIdDropDownList.SelectedValue))
                {
                    //for (int i = 0; i < customerListGridView.Rows.Count; i++)
                    //{
                    //    if (customerListGridView.Rows[i].Cells[0].Text.Equals(customerIdDropDownList.SelectedValue))
                    //    {
                    //        customerNameTextBox.Text = customerListGridView.Rows[i].Cells[1].Text;
                    //        customerContactNumberTextBox.Text = customerListGridView.Rows[i].Cells[2].Text;
                    //        customerAddressTextBox.Text = customerListGridView.Rows[i].Cells[3].Text;
                    //        break;
                    //    }
                    //}
                }
                else
                {
                    customerNameTextBox.Text = "";
                    customerContactNumberTextBox.Text = "";
                    customerAddressTextBox.Text = "";
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                customer = null;
            }
        }
Example #3
0
        protected void GetCustomerById(string customerId)
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                DataTable dt = customer.GetCustomerById(customerId);

                if (dt.Rows.Count > 0)
                {
                    customerNameTextBox.Text = dt.Rows[0]["CustomerName"].ToString();
                    //countryTextBox.Text = dt.Rows[0]["Country"].ToString();
                    //cityTextBox.Text = dt.Rows[0]["City"].ToString();
                    //districtTextBox.Text = dt.Rows[0]["District"].ToString();
                    //postalCodeTextBox.Text = dt.Rows[0]["PostalCode"].ToString();
                    //nationalIdTextBox.Text = dt.Rows[0]["NationalId"].ToString();
                    //passportNumberTextBox.Text = dt.Rows[0]["PassportNumber"].ToString();
                    contactNumberTextBox.Text = dt.Rows[0]["ContactNumber"].ToString();
                    emailTextBox.Text = dt.Rows[0]["Email"].ToString();
                    addressTextBox.Text = dt.Rows[0]["Address"].ToString();
                    txtbxDescription.Text = dt.Rows[0]["AdditionalInfo"].ToString();
                    cityTextBox.Text = dt.Rows[0]["City"].ToString();

                    joiningSalesCenterDropDownList.SelectedValue = dt.Rows[0]["JoiningSalesCenterId"].ToString();
                    if (joiningSalesCenterDropDownList.SelectedValue != dt.Rows[0]["JoiningSalesCenterId"].ToString())
                    {
                        joiningSalesCenterDropDownList.Items.Insert(1, new ListItem(dt.Rows[0]["JoiningSalesCenterName"].ToString(), dt.Rows[0]["JoiningSalesCenterId"].ToString()));
                        joiningSalesCenterDropDownList.SelectedIndex = 1;
                    }
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Customer Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                customer = null;
            }
        }