Esempio n. 1
0
    public static int Update_Old_Intake(User_Property_Tbl_Old_Intake u)
    {
        SqlCommand cmd = new SqlCommand();

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "update_tbl_old_intake_sp";
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@old_id", u.old_id));

        cmd.Parameters.Add(Create_Parameter.Convert_Int("@s_cat_id", u.s_cat_id));
        cmd.Parameters.Add(Create_Parameter.Convert_String("@prod_description", u.prod_description));
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@prod_weight", u.prod_weight));
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@prod_price", u.prod_price));
        cmd.Parameters.Add(Create_Parameter.Convert_String("@prod_type", u.prod_type));
        cmd.Parameters.Add(Create_Parameter.Convert_String("@intake_date", u.in_date));
        return(Create_Command.Execute_Non_Query(cmd));
    }
    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();
    }