Пример #1
0
    protected void grv_view_prod_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "sell")
        {
            User_Property_Tbl_Temp_Selling ut = new User_Property_Tbl_Temp_Selling();
            ut.c_id = find_customer_id();
            ut.p_id = e.CommandArgument.ToString();

            ut.bill_no = Session["bill_no"].ToString();


            string    prod_price = "";
            DataTable dt         = Select_Logic.get_data_with_two_para("select_tbl_product_give_id", ut.p_id);
            prod_price = dt.Rows[0]["prod_price"].ToString();

            ut.prod_price = find_product_price();

            Insert_Logic.Insert_Temp_Selling(ut);


            Update_Logic.update_status("update_status_tbl_product_sp", "0", ut.p_id);
            //deduct stock from tbl_stock where p_id=here p_id
            DataTable dt1   = Select_Logic.Find_Stock_Information("tbl_stock_give_p_id", ut.p_id);
            int       stock = Convert.ToInt32((dt1.Rows[0][2]).ToString());
            stock = stock - 1;
            //update stock
            string sub_cat_id = dt.Rows[0]["sub_cat_id"].ToString();
            Update_Logic.deduct_stock(sub_cat_id, stock.ToString());
        }
    }
Пример #2
0
    public static int Insert_Temp_Selling(User_Property_Tbl_Temp_Selling u)
    {
        SqlCommand cmd = new SqlCommand();

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "insert_tbl_temp_selling_sp";

        cmd.Parameters.Add(Create_Parameter.Convert_Int("@p_id", u.p_id));
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@c_id", u.c_id));
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@prod_price", u.prod_price));
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@bill_no", u.bill_no));



        return(Create_Command.Execute_Non_Query(cmd));
    }
Пример #3
0
    // data entry in temp selling table
    //sell first prodect from home page
    protected void btn_ok_Click(object sender, EventArgs e)
    {
        string unique_id  = Session["unique_id"].ToString();
        string product_id = Session["id"].ToString();

        //insert customer data in customer table
        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_mobile_no.Text;
        c.c_name          = txt_customer_name.Text;
        Insert_Logic.Insert_Customer(c);


        //insert data in temp selling table
        cus_id = find_customer_id();
        User_Property_Tbl_Temp_Selling ut = new User_Property_Tbl_Temp_Selling();

        ut.p_id       = product_id;
        ut.prod_price = find_product_price();
        ut.c_id       = cus_id;
        ut.bill_no    = Session["bill_no"].ToString();
        Insert_Logic.Insert_Temp_Selling(ut);


        Update_Logic.update_status("update_status_tbl_product_sp", "0", Session["id"].ToString());
        //deduct stock from tbl_stock where p_id=here p_id
        DataTable dt    = Select_Logic.Find_Stock_Information("tbl_stock_give_p_id", ut.p_id);
        int       stock = Convert.ToInt32((dt.Rows[0][2]).ToString());

        stock = stock - 1;
        //update stock
        string sub_cat_id = dt.Rows[0]["sub_cat_id"].ToString();

        Update_Logic.deduct_stock(sub_cat_id, stock.ToString());
    }