protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Session["u_name"] == null)
                {
                    Response.Redirect("error_login_page.aspx");
                }
                if (!IsPostBack)
                {
                    DropDownList_UCust_Country.Items.Add(new ListItem("Select Country", "0", true));
                    DropDownList_UCust_State.Items.Add(new ListItem("Select State", "0", true));
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
Exemple #2
0
        //Auto population of state

        protected void ddlcountry_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                DataSet dt2 = new DataSet();
                objentity.Country_name = ddlcountry.Text;
                dt2 = objbl.getstatelist(objentity);

                ddlstate.DataSource     = dt2;
                ddlstate.DataTextField  = "state_name";
                ddlstate.DataValueField = "state_name";
                ddlstate.DataBind();
                ddlstate.Items.Insert(0, new ListItem("Select State", "0"));
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void Button3_Click(object sender, EventArgs e)
        {
            try
            {
                TextBoxCID.Text     = " ";
                TextBoxAMTPAY.Text  = " ";
                TextBoxCCNUM.Text   = " ";
                TextBoxCNUM.Text    = " ";
                TextBoxCVV.Text     = " ";
                TextBoxPayDate.Text = " ";
                TextBoxPndAmt.Text  = " ";
                TextBoxVNAME.Text   = " ";
                DropDownLSelectMonth.SelectedIndex = 0;
                DropDownSelectYear.SelectedIndex   = 0;
                DropDownVType.SelectedIndex        = 0;
                DropDownCardType.SelectedIndex     = 0;
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
Exemple #4
0
        //retrieval of certificate_isued_date and certificate_validity_date

        protected void TextBoxwebsite_TextChanged(object sender, EventArgs e)
        {
            try
            {
                TextBoxcertiissueddate.Text   = DateTime.Now.ToString("yyyy-MM-dd");
                TextBoxcertivaliditydate.Text = DateTime.Now.AddYears(15).ToString("yyyy-MM-dd");
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void vendor_type_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                customer_registration_entity customer = new customer_registration_entity();
                customer_registration_bal    cust_bal = new customer_registration_bal();
                customer.Vendor_type = vendor_type.Text;
                DataSet ds             = cust_bal.populate_vendor_bl(customer);
                double  balance_amount = cust_bal.populate_balance_bl(customer);
                bal.Text = balance_amount.ToString();
                vendor_name.DataSource     = ds;
                vendor_name.DataTextField  = "vendor_name";
                vendor_name.DataValueField = "vendor_name";
                vendor_name.DataBind();
                vendor_name.Items.Insert(0, new ListItem("Select Vendor Name", "0"));
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void country_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string c = country.Text;
                customer_registration_entity customer = new customer_registration_entity();
                customer_registration_bal    cust_bal = new customer_registration_bal();
                customer.Country_name = c;
                DataSet ds = cust_bal.populate_state_bl(customer);
                state.DataSource     = ds;
                state.DataTextField  = "state_name";
                state.DataValueField = "state_name";
                state.DataBind();
                state.Items.Insert(0, new ListItem("Select State", "0"));
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void Button1_Click1(object sender, EventArgs e)
        {
            try
            {
                customer_registration_entity customer = new customer_registration_entity();
                customer.Customer_name          = Cust_name.Text;
                customer.Address_details        = address.Text;
                customer.Country_name           = country.Text;
                customer.State_name             = state.Text;
                customer.Contact_number         = (contact.Text);
                customer.Document_detail_number = doc_num.Text;
                customer.Email_id          = email.Text;
                customer.Registration_date = reg_date.Text;
                customer.Vendor_name       = vendor_name.Text;
                customer.Card_number       = card.Text;
                customer.Balance           = Convert.ToSingle(bal.Text);
                customer.Vendor_type       = vendor_type.Text;
                customer_registration_bal cust_bal = new customer_registration_bal();
                int a = cust_bal.validate_customer(customer);
                if (a == 1)
                {
                    int s = cust_bal.insert(customer);
                    if (s > 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Successfully Registered')", true);
                    }
                    else if (s == -1)
                    {
                        Label_Cus_Reg_State.Text = "Select Valid Country and State";
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Failure')", true);
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Customer is already Registered')", true);
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs
            Exception exception = Server.GetLastError();

            // Response.Write("<h2>Global Page Error</h2>\n");

            // Response.Write("<p>" + exception.Message + "</p>\n");

            ExceptionClass.LogException(exception);

            Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

            // Clear the error from the server

            Server.ClearError();
        }
        protected void doc_num_TextChanged(object sender, EventArgs e)
        {
            try
            {
                customer_registration_entity customer = new customer_registration_entity();
                customer_registration_bal    cust_bal = new customer_registration_bal();
                customer.Document_name          = id_doc.Text;
                customer.Document_detail_number = doc_num.Text;
                if (doc_num.Text != "")
                {
                    LabelDocDetNum.Text = " ";
                    string s = cust_bal.validate_doc(customer);
                    if (s == "invalid")
                    {
                        LabelDocDetNum.Text = "The document number you entered is invalid.!!";
                    }
                    else
                    {
                        LabelDocDetNum.Text = " ";
                    }
                }
                else
                {
                    LabelDocDetNum.Text = "Document Number is Required";
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
Exemple #10
0
        //retrieval of vendor_name and vendor_type based on company_registration_number

        protected void TextBoxcompanyno_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (TextBoxcompanyno.SelectedValue == "Select")
                {
                    Label_Vend_Reg.Text = "Select Valid Company Registration Number";
                }
                else
                {
                    objentity.Company_registration_number = Convert.ToInt32(TextBoxcompanyno.Text);
                    SqlDataReader rd2 = objbl.vendor_details(objentity);

                    if (rd2.HasRows)
                    {
                        rd2.Read();
                        Label_Vend_Reg.Text = " ";
                        vendorname          = rd2["vendor_name"].ToString();
                        vendortype          = rd2["vendor_type"].ToString();
                        //    rd2.Close();
                        TextBox2vendorname.Text = vendorname;
                        TextBoxvendortype.Text  = vendortype;
                    }
                }
            }

            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                bill.Customerid    = Convert.ToInt32(TextBoxCID.Text);
                bill.VendorType    = DropDownVType.Text;
                bill.Vendorname    = TextBoxVNAME.Text;
                bill.Pendingamount = Convert.ToDecimal(TextBoxPndAmt.Text);
                bill.Paymentdate   = TextBoxPayDate.Text;
                bill.Amounttopay   = Convert.ToDecimal(TextBoxAMTPAY.Text);
                bill.Cardnumber    = TextBoxCNUM.Text;
                int s = balobj.insert(bill);
                if (s != 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Bill Paid Successfully')", true);

                    int k = balobj.balsendbalance(bill);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Failure')", true);
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void DropDownVType_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                bill.Customerid = Convert.ToInt32(TextBoxCID.Text);
                bill.VendorType = DropDownVType.Text;
                SqlDataReader rd4 = balobj.balget_amt_name(bill);
                if (rd4.HasRows)
                {
                    rd4.Read();
                    TextBoxVNAME.Text  = rd4["vendor_name"].ToString();
                    TextBoxPndAmt.Text = rd4["balance"].ToString();
                    LableVtype.Text    = " ";
                }
                else
                {
                    LableVtype.Text    = "*This Customer is not registered with this vendor type";
                    TextBoxVNAME.Text  = " ";
                    TextBoxPndAmt.Text = " ";
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
Exemple #13
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                TextBoxcompanyno.Text         = null;
                TextBox2vendorname.Text       = "";
                TextBoxvendortype.Text        = "";
                TextBoxcontact.Text           = null;
                TextBoxemail.Text             = "";
                TextBoxwebsite.Text           = "";
                TextBoxaddress.Text           = "";
                ddlcountry.SelectedIndex      = 0;
                ddlstate.SelectedIndex        = 0;
                TextBoxemployeecount.Text     = null;
                TextBoxcustomercount.Text     = null;
                TextBoxyearestablishment.Text = null;
                TextBoxcertiissueddate.Text   = null;
                TextBoxcertivaliditydate.Text = null;
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                Cust_name.Text            = " ";
                address.Text              = " ";
                country.SelectedIndex     = 0;
                state.SelectedIndex       = 0;
                contact.Text              = " ";
                email.Text                = " ";
                id_doc.SelectedIndex      = 0;
                doc_num.Text              = " ";
                vendor_type.SelectedIndex = 0;
                vendor_name.SelectedIndex = 0;
                reg_date.Text             = " ";
                card.Text = " ";
                bal.Text  = " ";
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void vendor_name_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                reg_date.Text = DateTime.Now.ToString("yyyy-MM-dd");
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void update_button_Click(object sender, EventArgs e)
        {
            try
            {
                obj1.Customer_id            = Convert.ToInt16(cust_id.Text);
                obj1.Vendor_name            = vname_id.Text;
                obj1.Vendor_type            = vtype_id.Text;
                obj1.Customer_name          = cname_id.Text;
                obj1.Contact_number         = contact_id.Text;
                obj1.Balance                = Convert.ToDecimal(balance_txt.Text);
                obj1.Email_id               = email_id.Text;
                obj1.Addres_details         = add_id.Text;
                obj1.Country_id             = country_id.Text;
                obj1.Document_detail_number = document_id.Text;
                obj1.Registration_date      = registration_id.Text;
                obj1.Card_number            = card_number.Text;
                obj1.Country_name           = DropDownList_UCust_Country.Text;
                obj1.State_name             = DropDownList_UCust_State.Text;



                SqlDataReader rd4 = obj2.get_country_id_bl(obj1);
                if (rd4.HasRows)
                {
                    rd4.Read();
                    country_id2            = (string)rd4["country_id"];
                    LabelSelectStates.Text = " ";
                    country_id.Text        = country_id2;
                    int r = obj2.update_all_details_bl(obj1);
                    obj1.Country_id = country_id2;
                    int f = obj2.update_country_id_bl(obj1);
                    if (r > 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Update is successfull')", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Try Again')", true);
                    }
                }
                else
                {
                    LabelSelectStates.Text = "Select Valid Country and State";
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void Button2_Click1(object sender, EventArgs e)
        {
            try
            {
                obj1.vendor_id                 = DropDownListVendor_id.SelectedValue.ToString();
                obj1.Certificate_name          = certificate_name.Text;
                obj1.Certificate_issue_date    = c_i_d.Text;
                obj1.Certificate_validity_date = c_v_d.Text;
                obj1.Country_name              = DropDownList_UVend_Country.Text;
                obj1.State_name                = DropDownList_UVend_State.Text;
                obj1.Address_details           = address.Text;
                obj1.Contact_number            = contact_number.Text;
                obj1.Email_id1                 = email_id.Text;
                obj1.Website         = website.Text;
                obj1.Employees_count = emp_count.Text;
                obj1.Customer_count  = cust_count.Text;


                SqlDataReader rd4 = obj2.get_country_id_bl(obj1);
                if (rd4.HasRows)
                {
                    rd4.Read();
                    Label_UVend_Country.Text = " ";
                    country_id2     = (string)rd4["country_id"];
                    obj1.Country_id = country_id2;
                    int r = obj2.bal_update_country_in_vendor_table(obj1);



                    int f = obj2.updateallbal(obj1);


                    if (f > 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Update is successfull')", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Try Again')", true);
                    }
                }
                else
                {
                    Label_UVend_Country.Text = "Select Valid Country and State";
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void document_id_TextChanged(object sender, EventArgs e)
        {
            try
            {
                string s = document_id.Text;
                if (s.Length < 2)
                {
                    Label.Text = "*Please Enter Valid Document Number";
                }

                else if (s.Substring(0, 3) == "PAN" || s.Substring(0, 3) == "GMV")
                {
                    Label.Text = " ";
                }

                else if (s.Length >= 2)
                {
                    if (s.Substring(0, 2) == "DL")
                    {
                        Label.Text = " ";
                    }
                    else
                    {
                        if (s.Length >= 4)
                        {
                            if (s.Substring(0, 4) == "PASS")
                            {
                                Label.Text = " ";
                            }
                            else
                            {
                                Label.Text = "*Please Enter Valid Document Number";
                            }
                        }
                        else
                        {
                            Label.Text = "*Please Enter Valid Document Number";
                        }
                    }
                }
                else
                {
                    Label.Text = "*Please Enter Valid Document Number";
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            cust_id.Text = GridView1.SelectedRow.Cells[1].Text;
            try
            {
                obj1.Customer_id = Convert.ToInt32(cust_id.Text);


                SqlDataReader rd1 = obj2.get_details_from_text_bl(obj1);
                if (rd1.HasRows)
                {
                    Label_U_Cust.Text = " ";
                    rd1.Read();
                    vendor_name1            = (rd1["vendor_name"].ToString());
                    vendor_type1            = (rd1["vendor_type"].ToString());
                    customer_name1          = (rd1["customer_name"].ToString());
                    contact_number1         = (rd1["contact_number"].ToString());
                    balance1                = (Convert.ToDecimal(rd1["balance"]));
                    email_id1               = (rd1["email_id"].ToString());
                    addres_details1         = (rd1["addres_details"].ToString());
                    country_id1             = (rd1["country_id"].ToString());
                    document_detail_number1 = (rd1["document_detail_number"].ToString());
                    registration_date1      = (rd1["registration_date"].ToString());
                    card_number1            = (rd1["card_number"].ToString());
                    vname_id.Enabled        = false;
                    vtype_id.Enabled        = false;
                    obj1.Country_id         = country_id1;
                    SqlDataReader rd2 = obj2.get_country_state_bl(obj1);

                    if (rd2.HasRows)
                    {
                        rd2.Read();
                        country_name1 = (string)rd2["country_name"];
                        state_name1   = (string)rd2["state_name"];
                    }

                    vname_id.Text    = vendor_name1;
                    vtype_id.Text    = vendor_type1;
                    cname_id.Text    = customer_name1;
                    contact_id.Text  = contact_number1;
                    balance_txt.Text = balance1.ToString();
                    email_id.Text    = email_id1;
                    add_id.Text      = addres_details1;
                    country_id.Text  = country_id1;
                    DropDownList_UCust_Country.SelectedIndex = DropDownList_UCust_Country.Items.IndexOf(DropDownList_UCust_Country.Items.FindByValue(country_name1));
                    {
                        string c = DropDownList_UCust_Country.Text;
                        customer_registration_entity customer = new customer_registration_entity();
                        customer_registration_bal    cust_bal = new customer_registration_bal();
                        customer.Country_name = c;
                        DataSet ds = cust_bal.populate_state_bl(customer);
                        DropDownList_UCust_State.DataSource     = ds;
                        DropDownList_UCust_State.DataTextField  = "state_name";
                        DropDownList_UCust_State.DataValueField = "state_name";
                        DropDownList_UCust_State.DataBind();
                        DropDownList_UCust_State.Items.Insert(0, new ListItem("Select State", "0"));
                    }
                    DropDownList_UCust_State.SelectedIndex = DropDownList_UCust_State.Items.IndexOf(DropDownList_UCust_State.Items.FindByValue(state_name1));
                    document_id.Text     = document_detail_number1;
                    registration_id.Text = registration_date1;
                    card_number.Text     = card_number1;
                    cust_id.Enabled      = false;

                    //rd2.Close();
                }
                else
                {
                    Label_U_Cust.Text = "Enter Valid Customer ID";
                    cust_id.Enabled   = true;
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void DropDownListVendor_id_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                obj1.Vendor_id = DropDownListVendor_id.SelectedValue;

                SqlDataReader rd1 = obj2.insert1(obj1);
                if (rd1.HasRows)
                {
                    rd1.Read();
                    Company_Registration_Number1 = (rd1["Company_Registration_Number"].ToString());
                    Vendor_Type1                 = (rd1["Vendor_Type"].ToString());
                    Vendor_Name1                 = (rd1["Vendor_Name"].ToString());
                    Certificate_Name1            = (rd1["Certificate_Name"].ToString());
                    Certificate_Issue_Date1      = (rd1["Certificate_Issue_Date"].ToString());
                    Certificate_Validation_Date1 = (rd1["certificate_validity_date"].ToString());
                    Year_Of_Establishment1       = (rd1["Year_Of_Establishment"].ToString());
                    Country1 = rd1["country_name"].ToString();
                    State1   = rd1["state_name"].ToString();

                    Address1        = (rd1["address_details"].ToString());
                    Contact_Number1 = (rd1["Contact_Number"].ToString());
                    Email_Id1       = (rd1["Email_Id"].ToString());
                    Website1        = (rd1["Website"].ToString());
                    Employee_Count1 = (rd1["employees_count"].ToString());
                    Customer_Count1 = (rd1["customer_count"].ToString());
                }


                c_r_n.Text            = Company_Registration_Number1;
                vendor_type.Text      = Vendor_Type1;
                vendor_name.Text      = Vendor_Name1;
                certificate_name.Text = Certificate_Name1;
                c_i_d.Text            = Certificate_Issue_Date1;
                c_v_d.Text            = Certificate_Validation_Date1;
                yoe.Text = Year_Of_Establishment1;

                DropDownList_UVend_Country.SelectedIndex = DropDownList_UVend_Country.Items.IndexOf(DropDownList_UVend_Country.Items.FindByValue(Country1));
                {
                    string d = DropDownList_UVend_Country.Text;
                    customer_registration_entity customer = new customer_registration_entity();
                    customer_registration_bal    cust_bal = new customer_registration_bal();
                    customer.Country_name = d;
                    DataSet ds = cust_bal.populate_state_bl(customer);
                    DropDownList_UVend_State.DataSource     = ds;
                    DropDownList_UVend_State.DataTextField  = "state_name";
                    DropDownList_UVend_State.DataValueField = "state_name";
                    DropDownList_UVend_State.DataBind();
                    DropDownList_UVend_State.Items.Insert(0, new ListItem("Select State", "0"));
                }
                DropDownList_UVend_State.SelectedIndex = DropDownList_UVend_State.Items.IndexOf(DropDownList_UVend_State.Items.FindByValue(State1));
                address.Text                  = Address1;
                contact_number.Text           = Contact_Number1;
                email_id.Text                 = Email_Id1;
                website.Text                  = Website1;
                emp_count.Text                = Employee_Count1;
                cust_count.Text               = Customer_Count1;
                DropDownListVendor_id.Enabled = false;
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
Exemple #21
0
        protected void buttonsubmit_Click(object sender, EventArgs e)
        {
            try

            {
                objentity.Company_registration_number = Convert.ToInt32(TextBoxcompanyno.Text);
                int b = objbl.validate_vendor_bal(objentity);

                if (b == 1)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('This Vendor is already Registered')", true);
                }
                else
                {
                    DateTime issue_date;
                    DateTime validity_date;
                    DateTime.TryParseExact(TextBoxcertiissueddate.Text, "yyyy-MM-dd", null, System.Globalization.DateTimeStyles.None, out issue_date);
                    DateTime.TryParseExact(TextBoxcertivaliditydate.Text, "yyyy-MM-dd", null, System.Globalization.DateTimeStyles.None, out validity_date);

                    //year_of_survival=current year-year_of_survival ArgumentOutOfRangeException establishment
                    //calculating certificate_id

                    year_of_survival = DateTime.Now.Year - (Convert.ToInt16(TextBoxyearestablishment.Text));

                    employees_count          = Convert.ToInt16(TextBoxemployeecount.Text);
                    Label_Vend_Reg_Cert.Text = " ";
                    if (year_of_survival >= 1 && year_of_survival < 5 && employees_count >= 30 && employees_count < 50)
                    {
                        objentity.Certificate_id = 1;
                    }
                    else if (year_of_survival >= 5 && year_of_survival < 10 && employees_count >= 50 && employees_count < 75)
                    {
                        objentity.Certificate_id = 2;
                    }
                    else if (year_of_survival >= 10 && year_of_survival < 15 && employees_count >= 75 && employees_count < 100)
                    {
                        objentity.Certificate_id = 3;
                    }
                    else if (year_of_survival >= 15 && year_of_survival < 25 && employees_count >= 100 && employees_count < 200)
                    {
                        objentity.Certificate_id = 4;
                    }
                    else if (year_of_survival >= 25 && year_of_survival < 50 && employees_count >= 200 && employees_count < 500)
                    {
                        objentity.Certificate_id = 5;
                    }
                    else if (year_of_survival >= 50 && employees_count >= 500)
                    {
                        objentity.Certificate_id = 6;
                    }

                    else
                    {
                        Label_Vend_Reg_Cert.Text = "Enter Valid Employee Count as per the given data";
                        f = 1;
                    }
                    //passing textbox values to entity layer
                    if (f == 0)
                    {
                        objentity.Company_registration_number = Convert.ToInt32(TextBoxcompanyno.Text);
                        objentity.Vendor_name               = TextBox2vendorname.Text;
                        objentity.Vendor_type               = TextBoxvendortype.Text;
                        objentity.Contact_number            = TextBoxcontact.Text;
                        objentity.Email_id1                 = TextBoxemail.Text;
                        objentity.Website                   = TextBoxwebsite.Text;
                        objentity.Address_details           = TextBoxaddress.Text;
                        objentity.Country_name              = ddlcountry.Text;
                        objentity.State_name                = ddlstate.Text;
                        objentity.Certificate_issue_date    = issue_date;
                        objentity.Employees_count           = Convert.ToInt16(TextBoxemployeecount.Text);
                        objentity.Customer_count            = Convert.ToInt16(TextBoxcustomercount.Text);
                        objentity.Year_of_establishment     = Convert.ToInt16(TextBoxyearestablishment.Text);
                        objentity.Certificate_validity_date = validity_date;

                        int result = objbl.insert(objentity);

                        if (result == 1)
                        {
                            //Response.Write("registration successful");
                            ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Successfully Registered')", true);
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Registration Failed')", true);
                        }
                        if (Session["u_name"] == null)
                        {
                            Response.Redirect("admin_login.aspx");
                        }
                    }
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void emp_count_TextChanged(object sender, EventArgs e)
        {
            //year_of_survival=current year-year_of_survival ArgumentOutOfRangeException establishment
            //calculating certificate_id
            try
            {
                year_of_survival = DateTime.Now.Year - (Convert.ToInt16(yoe.Text));

                employees_count = Convert.ToInt32(emp_count.Text);

                if (year_of_survival >= 1 && year_of_survival < 5 && employees_count >= 30 && employees_count < 50)
                {
                    obj1.Certificate_id   = 1;
                    obj1.Certificate_name = "A+";
                    certificate_name.Text = "A+";
                    c_i_d.Text            = DateTime.Now.ToString("yyyy-MM-dd");
                    c_v_d.Text            = DateTime.Now.AddYears(15).ToString("yyyy-MM-dd");
                }
                else if (year_of_survival >= 5 && year_of_survival < 10 && employees_count >= 50 && employees_count < 75)
                {
                    obj1.Certificate_id   = 2;
                    obj1.Certificate_name = "B+";
                    certificate_name.Text = "B+";
                    c_i_d.Text            = DateTime.Now.ToString("yyyy-MM-dd");
                    c_v_d.Text            = DateTime.Now.AddYears(15).ToString("yyyy-MM-dd");
                }
                else if (year_of_survival >= 10 && year_of_survival < 15 && employees_count >= 75 && employees_count < 100)
                {
                    obj1.Certificate_id   = 3;
                    obj1.Certificate_name = "C+";
                    certificate_name.Text = "C+";
                    c_i_d.Text            = DateTime.Now.ToString("yyyy-MM-dd");
                    c_v_d.Text            = DateTime.Now.AddYears(15).ToString("yyyy-MM-dd");
                }
                else if (year_of_survival >= 15 && year_of_survival < 25 && employees_count >= 100 && employees_count < 200)
                {
                    obj1.Certificate_id   = 4;
                    obj1.Certificate_name = "D+";
                    certificate_name.Text = "D+";
                    c_i_d.Text            = DateTime.Now.ToString("yyyy-MM-dd");
                    c_v_d.Text            = DateTime.Now.AddYears(15).ToString("yyyy-MM-dd");
                }
                else if (year_of_survival >= 25 && year_of_survival < 50 && employees_count >= 200 && employees_count < 500)
                {
                    obj1.Certificate_id   = 5;
                    obj1.Certificate_name = "E+";
                    certificate_name.Text = "E+";
                    c_i_d.Text            = DateTime.Now.ToString("yyyy-MM-dd");
                    c_v_d.Text            = DateTime.Now.AddYears(15).ToString("yyyy-MM-dd");
                }
                else if (year_of_survival >= 50 && employees_count >= 500)
                {
                    obj1.Certificate_id   = 6;
                    obj1.Certificate_name = "F+";
                    certificate_name.Text = "F+";
                    c_i_d.Text            = DateTime.Now.ToString("yyyy-MM-dd");
                    c_v_d.Text            = DateTime.Now.AddYears(15).ToString("yyyy-MM-dd");
                }

                else
                {
                    Response.Redirect("vendor_updation_certificate_error.aspx");
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }