protected void btn_add_order_Click(object sender, EventArgs e) { if (Session["bill_no"] != "") { if (Convert.ToInt32(txt_total_amount.Text) < Convert.ToInt32(txt_paid_amount.Text)) { lbl_msg.Text = "Enter Valid Paid Amount"; mpe.Show(); } else { String remaining_amount = (Convert.ToInt32(txt_total_amount.Text) - Convert.ToInt32(txt_paid_amount.Text)).ToString(); Update_Logic.update_amount_order(txt_paid_amount.Text, remaining_amount, Session["bill_no"].ToString()); Response.Redirect("bill_order.aspx"); } } else { User_Property_Tbl_Order_Selling os = new User_Property_Tbl_Order_Selling(); //os.c_id = Select_Logic.load_customer_data_new_order(Session["order_bill_no"].ToString()).Rows[0]["c_id"].ToString(); os.total_payment = txt_total_amount.Text; os.paid_amount = txt_paid_amount.Text; os.remaininig_amount = ((Convert.ToInt32(os.total_payment)) - (Convert.ToInt32(os.paid_amount))).ToString(); os.bill_no = Session["order_bill_no"].ToString(); int i = Insert_Logic.Insert_Order_Selling(os); if (i == 1) { Response.Redirect("bill_order.aspx"); } } }
public static int Insert_Order_Selling(User_Property_Tbl_Order_Selling u) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "insert_tbl_order_selling"; cmd.Parameters.Add(Create_Parameter.Convert_Int("@total_payment", u.total_payment)); cmd.Parameters.Add(Create_Parameter.Convert_Int("@bill_no", u.bill_no)); cmd.Parameters.Add(Create_Parameter.Convert_Int("@paid_amount", u.paid_amount)); cmd.Parameters.Add(Create_Parameter.Convert_Int("@remaining_amount", u.remaininig_amount)); return(Create_Command.Execute_Non_Query(cmd)); }