public static int Insert_Order_Temp_Selling(User_Property_Tbl_Order_Temp_Selling u) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "insert_tbl_order_temp_selling"; cmd.Parameters.Add(Create_Parameter.Convert_Int("@order_id", u.order_id)); cmd.Parameters.Add(Create_Parameter.Convert_String("@product_name", u.product_name)); cmd.Parameters.Add(Create_Parameter.Convert_Int("@total_amount", u.total_amount)); cmd.Parameters.Add(Create_Parameter.Convert_Int("@bill_no", u.bill_no)); cmd.Parameters.Add(Create_Parameter.Convert_Int("@c_id", u.c_id)); return(Create_Command.Execute_Non_Query(cmd)); }
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(); }