protected void Button1_Click(object sender, EventArgs e) { if (Button1.Text == "Add") { User_Property_Tbl_Customer c = new User_Property_Tbl_Customer(); c.c_address = txt_customer_address.Text; c.c_email_address = txt_email_address.Text; c.c_mobile_no = txt_customer_mobile_no.Text; c.c_name = txt_customer_name.Text; customer_name = c.c_name; Insert_Logic.Insert_Customer(c); cid = find_customer_id(); User_Property_Tbl_Old_Intake o = new User_Property_Tbl_Old_Intake(); o.c_id = cid.ToString(); o.s_cat_id = ddl_sub_category_name.SelectedValue; o.in_date = txt_purchase_date.Text; o.prod_description = txt_prod_description.Text; o.prod_price = txt_prod_price.Text; o.prod_type = ddl_product_type.SelectedValue; o.prod_weight = txt_weight.Text; o.prod_quality = ddl_order_quality.SelectedValue; int i = Insert_Logic.Insert_Old_Intake(o); if (i == 1) { lbl_msg.Text = "Inserted"; } else { lbl_msg.Text = "Failed"; } } else { User_Property_Tbl_Customer c = new User_Property_Tbl_Customer(); c.c_address = txt_customer_address.Text; c.c_email_address = txt_email_address.Text; c.c_mobile_no = txt_customer_mobile_no.Text; c.c_name = txt_customer_name.Text; User_Property_Tbl_Old_Intake o = new User_Property_Tbl_Old_Intake(); o.c_id = Session["cus_id"].ToString(); c.c_id = o.c_id; o.s_cat_id = ddl_sub_category_name.SelectedValue; o.in_date = txt_purchase_date.Text; o.prod_description = txt_prod_description.Text; o.prod_price = txt_prod_price.Text; o.prod_type = ddl_product_type.SelectedValue; o.prod_weight = txt_weight.Text; o.prod_quality = ddl_order_quality.SelectedValue; o.old_id = s_id; int ii = Update_Logic.Update_Old_Intake(o); Update_Logic.Update_Customer(c); if (ii == 1) { Response.Redirect("manage_old_gold_purchase.aspx"); } else { lbl_msg.Text = "Updation Failed"; } } ModalPopupExtender1.Show(); }
protected void Button1_Click(object sender, EventArgs e) { User_Property_Tbl_Customer c = new User_Property_Tbl_Customer(); c.c_address = txt_customer_address.Text; c.c_email_address = txt_email_address.Text; c.c_mobile_no = txt_customer_mobile_no.Text; c.c_name = txt_customer_name.Text; User_Property_Tbl_Order o = new User_Property_Tbl_Order(); String cus_id = ""; if (Button1.Text == "Ok") { Insert_Logic.Insert_Customer(c); cus_id = find_customer_id(); c.c_id = cus_id.ToString(); //entry in order table o.product_name = txt_product_name.Text; o.book_name = txt_book_no.Text; o.design_no = txt_design_no.Text; o.o_type = ddl_order_type.SelectedValue; o.order_date = txt_order_date.Text; o.order_quality = ddl_order_quality.SelectedValue; o.prod_weight = txt_prod_weight.Text; o.o_type = ddl_order_type.SelectedValue; o.order_complete_date = txt_order_complete_date.Text; o.sub_cat_id = ddl_sub_category_name.SelectedValue; o.product_price = txt_product_price.Text; int i = Insert_Logic.Insert_Order(o); if (i == 1) { lbl_msg.ForeColor = System.Drawing.Color.Green; lbl_msg.Text = "Inserted"; } else { lbl_msg.Text = "Insertion Failed"; } //insert in temp selling table User_Property_Tbl_Order_Temp_Selling ots = new User_Property_Tbl_Order_Temp_Selling(); ots.bill_no = Session["order_bill_no"].ToString(); ots.order_id = find_order_id().ToString(); ots.c_id = cus_id; ots.total_amount = txt_product_price.Text; ots.product_name = txt_product_name.Text; int its = Insert_Logic.Insert_Order_Temp_Selling(ots); if (its == 1) { Response.Redirect("order_selling.aspx"); } } else { o.book_name = txt_book_no.Text; o.design_no = txt_design_no.Text; o.o_type = ddl_order_type.SelectedValue; o.order_date = txt_order_date.Text; o.order_quality = ddl_order_quality.SelectedValue; o.prod_weight = txt_prod_weight.Text; o.o_type = ddl_order_type.SelectedValue; o.order_complete_date = txt_order_complete_date.Text; o.sub_cat_id = ddl_sub_category_name.SelectedValue; o.order_id = x;//this is session id Update_Logic.Update_Customer(c); int ii = Update_Logic.Update_Order(o); if (ii == 1) { Response.Redirect("manage_order.aspx"); } else { lbl_msg.Text = "error"; } } ModalPopupExtender1.Show(); }