Example #1
0
        public DataTable SaveCustomer(CustomerBLL customer, LumexDBPlayer db)
        {
            try
            {
                db.AddParameters("@CustomerName", customer.CustomerName.Trim());
                db.AddParameters("@ContactNumber", customer.ContactNumber.Trim());
                db.AddParameters("@Email", customer.Email.Trim());
                db.AddParameters("@Country", customer.Country.Trim());
                db.AddParameters("@City", customer.City.Trim());
                db.AddParameters("@District", customer.District.Trim());
                db.AddParameters("@PostalCode", customer.PostalCode.Trim());
                db.AddParameters("@Address", customer.Address.Trim());
                db.AddParameters("@NationalId", customer.NationalId.Trim());
                db.AddParameters("@AdditionalInfo", customer.Description.Trim());
                db.AddParameters("@PassportNumber", customer.PassportNumber.Trim());
                db.AddParameters("@JoiningSalesCenterId", customer.JoiningSalesCenterId.Trim());
                db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString());
                db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal());

                DataTable dt = db.ExecuteDataTable("INSERT_CUSTOMER", true);
                return dt;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                customer = null;
            }
        }
Example #2
0
        //http://service.aaqa.co/sms.asmx/AaqaSMSApi?username=lumextech&pass=dkVBwKnE&MobNo=8801xxxxxxxxx&Sender=xxxxxxxxxxx&msg=xxxxxx
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                msgbox.Visible = false;
                if (!IsPostBack)
                {
                    CustomerBLL customerBll = new CustomerBLL();
                    DataTable dt = new DataTable();
                    dt = customerBll.GetActiveCustomerList();
                    customerListGridView.Visible = true;
                    customerListGridView.DataSource = dt;
                    customerListGridView.DataBind();

                }
                if (customerListGridView.Rows.Count > 0)
                {
                    customerListGridView.UseAccessibleHeader = true;
                    customerListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
            }
            catch (Exception)
            {

                throw;
            }

        }
        private void LoadCustomer()
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                customer.WarehouseId = LumexSessionManager.Get("UserWareHouseId").ToString();
               // DataTable dt = customer.GetActiveCustomerListByWHId();
                DataTable dt = customer.GetActiveCustomerList();
                customerDropDownList.DataSource = dt;
                customerDropDownList.DataValueField = "CustomerId";
                customerDropDownList.DataTextField = "CustomerIdName";
                customerDropDownList.DataBind();
                customerDropDownList.Items.Insert(0, "Select..");
                customerDropDownList.SelectedIndex = 0;


                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true;
                    msgTitleLabel.Text = "Customer are not available !!!";
                    msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                //
            }
        }
Example #4
0
        protected void GetCustomerList()
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                DataTable dt = customer.GetCustomerList();
                customerListGridView.DataSource = dt;
                customerListGridView.DataBind();

                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Customer List 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;
            }
        }
Example #5
0
        //protected void LoadSalesCenters()
        //{
        //    SalesCenterBLL salesCenter = new SalesCenterBLL();

        //    try
        //    {
        //        DataTable dt = salesCenter.GetActiveSalesCenterListByUser();

        //        joiningSalesCenterDropDownList.DataSource = dt;
        //        joiningSalesCenterDropDownList.DataValueField = "SalesCenterId";
        //        joiningSalesCenterDropDownList.DataTextField = "SalesCenterName";
        //        joiningSalesCenterDropDownList.DataBind();
        //        joiningSalesCenterDropDownList.Items.Insert(0, "");
        //        joiningSalesCenterDropDownList.SelectedIndex = 0;

        //        if (dt.Rows.Count < 1)
        //        {
        //            msgbox.Visible = true; msgTitleLabel.Text = "Joining Sales Center 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
        //    {
        //        salesCenter = null;
        //    }
        //}

        protected void saveButton_Click(object sender, EventArgs e)
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                if (customerNameTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Customer Name field is required.";
                }
                else if (addressTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Address field is required.";
                }
                else if (joiningSalesCenterDropDownList.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Joining Sales Center field is required.";
                }
                else
                {
                    customer.CustomerName = customerNameTextBox.Text.Trim();
                    customer.ContactNumber = contactNumberTextBox.Text.Trim();
                    customer.Email = emailTextBox.Text.Trim();
                    customer.Country = countryTextBox.Text.Trim();
                    customer.City = cityTextBox.Text.Trim();
                    customer.District = districtTextBox.Text.Trim();
                    customer.PostalCode = postalCodeTextBox.Text.Trim();
                    customer.Address = addressTextBox.Text.Trim();
                    customer.NationalId = nationalIdTextBox.Text.Trim();
                    //customer.Description = txtbxDescription.Text.Trim();
                    customer.PassportNumber = passportNumberTextBox.Text.Trim();
                    customer.JoiningSalesCenterId = joiningSalesCenterDropDownList.SelectedValue.Trim();

                    DataTable dt = customer.SaveCustomer();

                    if (dt.Rows.Count > 0)
                    {
                        string message = "Customer <span class='actionTopic'>Created</span> Successfully with Customer ID: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>.";
                        MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Customer/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");
                    }
                    else
                    {
                        string message = "<span class='actionTopic'>Failed</span> to Create Customer.";
                        MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");");
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                customer = null;
            }
        }
        protected void btnCustomerPaymentList_OnClick(object sender, EventArgs e)
        {
            CustomerBLL customerBll=new CustomerBLL();

            try
            {
                if (customerDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Business Name field is required.";
                }
                else if (fromDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()) == "False")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date From field is required.";
                }
                else if (toDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()) == "False")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date To field is required.";
                }
                else
                {
                    string customerId = customerDropDownList.SelectedValue.Trim();
                    string fromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim());
                    string toDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim());
                    string status = statusDropDownList.SelectedValue;

                    DataTable dt = customerBll.GetCustomerWisePaymentList(customerId, fromDate, toDate, status);
                    customerPaymentListGridView.DataSource = dt;
                    customerPaymentListGridView.DataBind();

                    if (customerPaymentListGridView.Rows.Count > 0)
                    {
                        customerPaymentListGridView.UseAccessibleHeader = true;
                        customerPaymentListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                    else
                    {
                        msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                customerBll = null;
            }
        }
        protected void deletedListButton_Click(object sender, EventArgs e)
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                if (fromDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()) == "False")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date From field is required.";
                }
                else if (toDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()) == "False")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date To field is required.";
                }
                else
                {
                    string fromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim());
                    string toDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim());

                    DataTable dt = customer.GetDeletedCustomerListByDateRangeAll(fromDate, toDate, "");

                    deletedListGridView.DataSource = dt;
                    deletedListGridView.DataBind();

                    if (deletedListGridView.Rows.Count > 0)
                    {
                        deletedListGridView.UseAccessibleHeader = true;
                        deletedListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                    else
                    {
                        msgbox.Visible = true; msgTitleLabel.Text = "Deleted Customer List Data Not Found!!!"; msgDetailLabel.Text = "";
                        msgbox.Attributes.Add("class", "alert alert-info");
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                customer = null;
                MyAlertBox("MyOverlayStop();");
            }
        }
Example #8
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 getCustomerList()
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                //DataTable dt = customer.GetCustomerById((string)LumexSessionManager.Get("ActiveUserId"));
                DataTable dt = customer.GetCustomerList();
                customerListGridView.DataSource = dt;
                customerListGridView.DataBind();

                if (customerListGridView.Rows.Count > 0)
                {
                    customerListGridView.UseAccessibleHeader = true;
                    customerListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }

                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Customer are not available !!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
        }
        protected void LoadActiveCustomerList()
        {
            CustomerBLL customer = new CustomerBLL();


            try
            {
                customer.WarehouseId = ddlSelectWareHouseOrSalesCenter.SelectedValue;
                DataTable dt = customer.GetActiveCustomerListByWHId();
                if (dt.Rows.Count > 0)
                {
                    customerIdDropDownList.DataSource = dt;
                    customerIdDropDownList.DataValueField = "CustomerId";
                    customerIdDropDownList.DataTextField = "CustomerIdName";
                    customerIdDropDownList.DataBind();
                    customerIdDropDownList.Items.Insert(0, "");
                    customerIdDropDownList.SelectedIndex = 0;
                }
                else
                {
                    customerIdDropDownList.DataSource = dt;
                    customerIdDropDownList.DataBind();
                    msgbox.Visible = true;
                    msgTitleLabel.Text = "Data Not Found";
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                customer = null;
            }
        }
        protected void LoadPayToFromCompanyList()
        {
            PayToFromCompanyBLL payToFromCompany = new PayToFromCompanyBLL();

            try
            {
                payToFromCompanyDropDownList.Items.Clear();
                DataTable dt = new DataTable();
                if (payToFromTypeDropDownList.SelectedValue == "com")
                {
                    dt = payToFromCompany.GetActivePayToFromCompanyList();
                    payToFromCompanyDropDownList.DataSource = dt;
                    payToFromCompanyDropDownList.DataValueField = "CompanyId";
                    payToFromCompanyDropDownList.DataTextField = "CompanyName";
                    payToFromCompanyDropDownList.DataBind();
                    lblPaytoFromType.Text = "Company";
                }
                else if (payToFromTypeDropDownList.SelectedValue == "ven")
                {
                    VendorBLL vendor = new VendorBLL();
                    dt = vendor.GetActiveVendors();
                    payToFromCompanyDropDownList.DataSource = dt;
                    payToFromCompanyDropDownList.DataValueField = "VendorId";
                    payToFromCompanyDropDownList.DataTextField = "VendorName";
                    payToFromCompanyDropDownList.DataBind();
                    lblPaytoFromType.Text = "Vendor";
                }
                else if (payToFromTypeDropDownList.SelectedValue == "cus")
                {
                    CustomerBLL customer = new CustomerBLL();
                    dt = customer.GetActiveCustomerList();
                    payToFromCompanyDropDownList.DataSource = dt;
                    payToFromCompanyDropDownList.DataValueField = "CustomerId";
                    payToFromCompanyDropDownList.DataTextField = "CustomerIdName";
                    payToFromCompanyDropDownList.DataBind();
                    lblPaytoFromType.Text = "Customer";

                }



                payToFromCompanyDropDownList.Items.Insert(0, "");
                payToFromCompanyDropDownList.Items.Insert(1, "N/A");
                payToFromCompanyDropDownList.SelectedIndex = 0;

                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Pay To/From Company 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
            {
                payToFromCompany = null;
            }
        }
Example #12
0
 internal DataTable GetActiveCustomerListByWHId(CustomerBLL customerBLL, LumexDBPlayer db)
 {
     try
     {
         db.AddParameters("@WHID", customerBLL.WarehouseId);
         DataTable dt = db.ExecuteDataTable("[GET_ACTIVE_CUSTOMER_LIST_BY_WH_ID]", true);
         return dt;
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #13
0
        public void UpdateCustomer(CustomerBLL customer, LumexDBPlayer db)
        {
            try
            {
                db.AddParameters("@CustomerId", customer.CustomerId.Trim());
                db.AddParameters("@CustomerName", customer.CustomerName.Trim());
                db.AddParameters("@ContactNumber", customer.ContactNumber.Trim());
                db.AddParameters("@Email", customer.Email.Trim());
                db.AddParameters("@Country", customer.Country.Trim());
                db.AddParameters("@City", customer.City.Trim());
                db.AddParameters("@District", customer.District.Trim());
                db.AddParameters("@PostalCode", customer.PostalCode.Trim());
                db.AddParameters("@Address", customer.Address.Trim());
                db.AddParameters("@NationalId", customer.NationalId.Trim());
                db.AddParameters("@AdditionalInfo", customer.Description.Trim());
                db.AddParameters("@PassportNumber", customer.PassportNumber.Trim());
                db.AddParameters("@JoiningSalesCenterId", customer.JoiningSalesCenterId.Trim());
                db.AddParameters("@ModifiedBy", LumexSessionManager.Get("ActiveUserId").ToString());
                db.AddParameters("@ModifiedFrom", LumexLibraryManager.GetTerminal());

                db.ExecuteNonQuery("UPDATE_CUSTOMER_BY_ID", true);
            }
            catch (Exception)
            {
                throw;
            }
            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 #15
0
        protected void btnimport_OnClick(object sender, EventArgs e)
        {
            StreamReader reader = null;
            string path = HttpContext.Current.Server.MapPath(WebConfigurationManager.AppSettings["attachmentPath"] +
                                                              "/tempCSV/");
            try
            {
                FileUpload customerCSV = new FileUpload();
                customerCSV = FileUpload1;

                if (customerCSV.HasFile)
                {
                    string chkExtension = Path.GetExtension(customerCSV.FileName);
                    // string ppImg = ImgID + Path.GetExtension(productImg.FileName);

                    if (chkExtension.ToLower() == ".csv")
                    {


                        if (!Directory.Exists(path))
                        {
                            Directory.CreateDirectory(path);
                        }
                        String userId = LumexSessionManager.Get("ActiveUserId").ToString();
                        path = path + @"\cr" + userId + ".csv";

                        customerCSV.PostedFile.SaveAs(path);


                        //need to implement here.
                        reader = new StreamReader(File.OpenRead(path));
                        int linecount = 0;
                        //int dupcount = 0;
                        while (!reader.EndOfStream)
                        {

                            var line = reader.ReadLine();
                            if (linecount != 0)
                            {
                                var pinfos = line.Split(',');
                                CustomerBLL customer = new CustomerBLL();


                                customer.CustomerName = pinfos[0];
                                customer.ContactNumber = pinfos[1];
                                customer.Email = pinfos[2];
                                customer.Country = "";

                                customer.District = "";
                                customer.PostalCode = "";

                                customer.NationalId = "";
                                customer.PassportNumber = "";
                                customer.JoiningSalesCenterId = pinfos[3];
                                customer.City = pinfos[4];



                                customer.Address = pinfos[5];
                                DataTable dt = customer.SaveCustomer();
                                //dupcount++;                            }


                            }
                            linecount++;

                            //reader.Close();

                        }
                        linecount--;
                        if (linecount > 0)
                        {


                            string message =
                                "Customer <span class='actionTopic'></span> Successfully import " + linecount +
                                " Customers.<span class='actionTopic'></span>.";
                            MyAlertBox(
                                "var callbackOk = function () { MyOverlayStop(); window.location = \"/UI/Customer/List.aspx\"; }; SuccessAlert(\"" +
                                "Process Succeed" + "\", \"" + message + "\", callbackOk);");


                        }

                    }
                    else
                    {
                        string message = "Only CSV File is allowed";
                        MyAlertBox("WarningAlert(\"" + "Validation" + "\", \"" + message + "\");");
                    }
                }
                else
                {
                    string message = " <span class='actionTopic'>" + "You are Not select any CSV file!</span>.";
                    MyAlertBox("WarningAlert(\"" + "Validation" + "\", \"" + message + "\");");

                }

            }
            catch (Exception ex)
            {

                string message = ex.Message;
                if (ex.InnerException != null)
                {
                    message += " --> " + ex.InnerException.Message;
                }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }

            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    File.Delete(path);
                }
            }
        }
Example #16
0
        protected void updateButton_Click(object sender, EventArgs e)
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                if (customerIdForUpdateHiddenField.Value.Trim() == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Customer not found to update.";
                }
                else if (customerNameTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Customer Name field is required.";
                }
                else if (addressTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Address field is required.";
                }
                //else if (joiningSalesCenterDropDownList.Text == "")
                //{
                //    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Joining Sales Center field is required.";
                //}
                else
                {
                    customer.CustomerId = customerIdForUpdateHiddenField.Value.Trim();
                    customer.CustomerName = customerNameTextBox.Text.Trim();
                    customer.ContactNumber = contactNumberTextBox.Text.Trim();
                    customer.Email = emailTextBox.Text.Trim();
                    customer.Country = ""; //countryTextBox.Text.Trim();
                    customer.City = cityTextBox.Text.Trim();
                    customer.District = ""; // districtTextBox.Text.Trim();
                    customer.PostalCode = ""; //postalCodeTextBox.Text.Trim();
                    customer.Address = addressTextBox.Text.Trim();
                    customer.NationalId = "";//nationalIdTextBox.Text.Trim();
                    customer.PassportNumber = "";//passportNumberTextBox.Text.Trim();
                    customer.JoiningSalesCenterId = joiningSalesCenterDropDownList.SelectedValue.Trim();
                    customer.Description = txtbxDescription.Text.Trim();

                    customer.UpdateCustomer();

                    customerIdForUpdateHiddenField.Value = "";

                    string message = "Customer <span class='actionTopic'>Updated</span> Successfully.";
                    MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Customer/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                customer = null;
            }
        }
Example #17
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;
            }
        }
Example #18
0
        protected void selectDropDownList_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            if (selectDropDownList.SelectedValue == "CST")
            {
                CustomerBLL customerBll = new CustomerBLL();
                DataTable dt = new DataTable();
                dt = customerBll.GetActiveCustomerList();
                customerListGridView.Visible = true;
                vendorGridView.Visible = false;
                companyGridView.Visible = false;
                NumberDiv.Visible = false;
                customerListGridView.DataSource = dt;
                customerListGridView.DataBind();
                if (customerListGridView.Rows.Count > 0)
                {
                    customerListGridView.UseAccessibleHeader = true;
                    customerListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }

            }
            else if (selectDropDownList.SelectedValue == "VND")
            {
                VendorBLL vendorBll = new VendorBLL();
                DataTable dt = new DataTable();
                dt = vendorBll.GetVendorList();
                vendorGridView.Visible = true;
                customerListGridView.Visible = false;
                companyGridView.Visible = false;
                NumberDiv.Visible = false;
                vendorGridView.DataSource = dt;
                vendorGridView.DataBind();

                if (vendorGridView.Rows.Count > 0)
                {
                    vendorGridView.UseAccessibleHeader = true;
                    vendorGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }

            }
            else if (selectDropDownList.SelectedValue == "COM")
            {
                CompanyBLL companyBll = new CompanyBLL();
                DataTable dt = new DataTable();
                dt = companyBll.GetActiveCompany();
                companyGridView.Visible = true;
                customerListGridView.Visible = false;
                vendorGridView.Visible = false;
                NumberDiv.Visible = false;
                companyGridView.DataSource = dt;
                companyGridView.DataBind();

                if (companyGridView.Rows.Count > 0)
                {
                    companyGridView.UseAccessibleHeader = true;
                    companyGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }

            }
            else
            {
                customerListGridView.Visible = false;
                vendorGridView.Visible = false;
                companyGridView.Visible = false;
                NumberDiv.Visible = true;
            }
        }
Example #19
0
        protected void GetCustomerListByWareHouseId()
        {
            CustomerBLL customer = new CustomerBLL();
            customer.WarehouseId = warehouseDropDownList.SelectedValue.Trim();

            try
            {
                DataTable dt = customer.GetCustomerListByWareHouseId();
                customerListGridView.DataSource = dt;
                customerListGridView.DataBind();

                if (customerListGridView.Rows.Count > 0)
                {
                    customerListGridView.UseAccessibleHeader = true;
                    customerListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Customer List 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;
            }
        }
Example #20
0
        protected void deleteLinkButton_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

                CustomerBLL customer = new CustomerBLL();
                customer.DeleteCustomer(customerListGridView.Rows[row.RowIndex].Cells[0].Text.ToString());

                GetCustomerListByWareHouseId();
                string message = "Customer <span class='actionTopic'>Deleted</span> Successfully.";
                MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");");
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
        }
        protected void LoadActiveCustomerList()
        {
            CustomerBLL customer = new CustomerBLL();

            try
            {
                DataTable dt = customer.GetActiveCustomerList();

                customerIdDropDownList.DataSource = dt;
                customerIdDropDownList.DataValueField = "CustomerId";
                customerIdDropDownList.DataTextField = "CustomerIdName";
                customerIdDropDownList.DataBind();
                //customerIdDropDownList.Items.Insert(0, "");
                //customerIdDropDownList.Items.Insert(1, "Retail");
                //customerIdDropDownList.SelectedIndex = 1;
                customerIdDropDownList.Items.Insert(0, "Retail");
                customerIdDropDownList.SelectedIndex = 0;
                customerIdDropDownList.Items[0].Value = "Retail";
                //Customer Gridview Load
                //  customerListGridView.DataSource = dt;
                //  customerListGridView.DataBind();

                //if (customerListGridView.Rows.Count > 0)
                //{
                //    customerListGridView.UseAccessibleHeader = true;
                //    customerListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                //}

                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Customer are not available !!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                customer = null;
            }
        }
        protected void LoadActiveCustomerList()
        {
            CustomerBLL customer = new CustomerBLL();
            customer.WarehouseId = salesCenterDropDownList.SelectedValue;
            try
            {
                DataTable dt = customer.GetActiveCustomerListByWHId();

                customerIdDropDownList.DataSource = dt;
                customerIdDropDownList.DataValueField = "CustomerId";
                customerIdDropDownList.DataTextField = "CustomerIdName";
                customerIdDropDownList.DataBind();
                customerIdDropDownList.Items.Insert(0, "");
                customerIdDropDownList.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                customer = null;
            }
        }