Exemplo n.º 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());
        }
    }
Exemplo n.º 2
0
    private void deduct_stock_delete_product(string id)
    {
        DataTable dt    = Select_Logic.Find_Stock_Information("tbl_stock_give_p_id", 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());
    }
Exemplo n.º 3
0
    protected void grv_prod_selling_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string id   = e.CommandArgument.ToString(); // id="temp_id"
        string p_id = find_product_id_give_temp_selling_id(id);

        //change status to one
        Update_Logic.update_status("update_status_tbl_product_sp", "1", p_id);

        //and update stock=stock+1
        DataTable dt1   = Select_Logic.Find_Stock_Information("tbl_stock_give_p_id", p_id);
        int       stock = Convert.ToInt32((dt1.Rows[0][2]).ToString());

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

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

        int ii = Delete_Logic.Delete_data("delete_tbl_temp_selling_sp", id);

        fetch_sell_data();
    }
Exemplo n.º 4
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());
    }