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 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(); } }
public int validate_customer_dal(customer_registration_entity c) { try { cmd = new SqlCommand("validate_customer", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Email_id", c.Email_id); cmd.Parameters.AddWithValue("@Vendor_name", c.Vendor_name); cmd.Parameters.AddWithValue("@Vendor_type", c.Vendor_type); con.Open(); rd2 = cmd.ExecuteReader(); if (rd2.HasRows) { flag = 0; // con.Dispose(); } else { flag = 1; // con.Dispose(); } cmd.Dispose(); return(flag); } catch (Exception ex) { throw ex; } }
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(); } }
public double populate_balance_bl(customer_registration_entity c) { try { customer_registration_dal cust_dal = new customer_registration_dal(); cust_dal.CreateCon(); return(cust_dal.populate_balance_dl(c)); } catch (Exception ex) { throw ex; } }
public string validate_doc(customer_registration_entity c) { try { customer_registration_dal cust_dal = new customer_registration_dal(); cust_dal.CreateCon(); return(cust_dal.validate_doc_dl(c)); } catch (Exception ex) { throw ex; } }
public DataSet populate_vendor_bl(customer_registration_entity c) { try { customer_registration_dal cust_dal = new customer_registration_dal(); cust_dal.CreateCon(); return(cust_dal.populate_vendor(c)); } catch (Exception ex) { throw ex; } }
public int insert(customer_registration_entity c) { try { customer_registration_dal cust_dal = new customer_registration_dal(); cust_dal.CreateCon(); return(cust_dal.insertdata(c)); } catch (Exception ex) { throw ex; } }
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(); } }
public int insertdata(customer_registration_entity c) { try { int result = -1; cmd = new SqlCommand("get_country_id", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@country_name", c.Country_name); cmd.Parameters.AddWithValue("@state_name", c.State_name); con.Open(); rd = cmd.ExecuteReader(); if (rd.HasRows) { rd.Read(); cid = (string)rd["country_id"]; c.Country_id = cid; cmd.Dispose(); con.Close(); cmd = new SqlCommand("insert_cust_reg", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@customer_name", c.Customer_name); cmd.Parameters.AddWithValue("@address_details", c.Address_details); cmd.Parameters.AddWithValue("@contact_number", c.Contact_number); cmd.Parameters.AddWithValue("@cid", c.Country_id); cmd.Parameters.AddWithValue("@email_id", c.Email_id); cmd.Parameters.AddWithValue("@registration_date", c.Registration_date); cmd.Parameters.AddWithValue("@card_number", c.Card_number); cmd.Parameters.AddWithValue("@document_detail_number", c.Document_detail_number); cmd.Parameters.AddWithValue("@vendor_type", c.Vendor_type); cmd.Parameters.AddWithValue("@vendor_name", c.Vendor_name); cmd.Parameters.AddWithValue("@balance", c.Balance); con.Open(); result = cmd.ExecuteNonQuery(); cmd.Dispose(); // con.Dispose(); } return(result); } catch (Exception ex) { throw ex; } }
public string validate_doc_dl(customer_registration_entity c) { try { con.Open(); cmd = new SqlCommand("validate_document", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@document_name", c.Document_name); if (c.Document_name == "Voter Id" || c.Document_name == "PAN card") { sub = c.Document_detail_number.Substring(0, 3); } else if (c.Document_name == "Driving License") { sub = c.Document_detail_number.Substring(0, 2); } else if (c.Document_name == "Pass port") { sub = c.Document_detail_number.Substring(0, 4); } // Console.WriteLine(sub); rd1 = cmd.ExecuteReader(); if (rd1.HasRows) { rd1.Read(); doc = (string)rd1["document_format"]; } // con.Dispose(); cmd.Dispose(); if (doc == sub) { return("valid"); } else { return("invalid"); } } catch (Exception ex) { throw ex; } }
public DataSet populate_vendor(customer_registration_entity c) { try { con.Open(); cmd = new SqlCommand("autopopulate_vendor", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@vendor_type", c.Vendor_type); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); // con.Dispose(); cmd.Dispose(); return(ds); } catch (Exception ex) { throw ex; } }
public double populate_balance_dl(customer_registration_entity c) { try { con.Open(); cmd = new SqlCommand("populate_balance", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@vendor_type", c.Vendor_type); rd = cmd.ExecuteReader(); if (rd.HasRows) { rd.Read(); balance = Convert.ToSingle(rd["amount"]); } // con.Dispose(); cmd.Dispose(); return(balance); } catch (Exception ex) { throw ex; } }
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(); } }