Ejemplo n.º 1
0
    protected void grv_stock_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string id = e.CommandArgument.ToString();

        if (e.CommandName == "del")
        {
            Delete_Logic.Delete_data("delete_tbl_stock_sp", id);
            bind_stock();
        }



        string status = "";

        if (e.CommandName == "act" || e.CommandName == "dec")
        {
            if (e.CommandName == "act")
            {
                status = "1";
            }
            else
            {
                status = "0";
            }
            Update_Logic.update_status("update_status_tbl_stock_sp", status, id);
            bind_stock();
        }
    }//end row command
    protected void grv_dealer_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        User_Property_id.id = e.CommandArgument.ToString();


        if (e.CommandName == "del")
        {
            ModalPopupExtender1.Show();
        }


        if (e.CommandName == "edt")
        {
            Session["id"] = User_Property_id.id;
            Response.Redirect("add_dealer.aspx");
        }


        string status = "";

        if (e.CommandName == "act" || e.CommandName == "dec")
        {
            if (e.CommandName == "act")
            {
                status = "1";
            }
            else
            {
                status = "0";
            }
            Update_Logic.update_status("update_status_tbl_dealer_sp", status, User_Property_id.id);
            bind_Dealer();
        }
    }
Ejemplo n.º 3
0
    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");
            }
        }
    }
    protected void btn_ok_Click(object sender, EventArgs e)
    {
        string u_name_session    = Session["username"].ToString();
        User_Property_tbl_user u = new User_Property_tbl_user();

        u.address   = txt_address.Text;
        u.shop_name = txt_shop_name.Text;
        u.user_name = txt_user_name.Text;
        u.photo     = "";

        int i = Update_Logic.update_user_data(u_name_session, u.user_name, u.address, u.shop_name, u.photo);

        if (i == 1)
        {
            ModalPopupExtender1.Show();
            modal_msg_lbl.Text      = "Update Successfully";
            modal_msg_lbl.ForeColor = System.Drawing.Color.Green;
            txt_user_name.Enabled   = false;
            txt_shop_name.Enabled   = false;
            txt_address.Enabled     = false;
        }
        else
        {
            modal_msg_lbl.Text = "Updation Failed";
            ModalPopupExtender1.Show();
            modal_msg_lbl.ForeColor = System.Drawing.Color.Red;
        }
    }
Ejemplo n.º 5
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());
        }
    }
Ejemplo n.º 6
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());
    }
Ejemplo n.º 7
0
    protected void btn_ok_Click(object sender, EventArgs e)
    {
        User_Property_Tbl_Sub_Category u = new User_Property_Tbl_Sub_Category();


        u.cat_id       = ddl_sub_category.SelectedValue.ToString();
        u.sub_cat_name = txt_sub_category_name.Text;



        //insert data in sub category table
        if (btn_ok.Text == "Add")
        {
            int i = Insert_Logic.Insert_Sub_Category(u);

            //For Stock
            User_Property_Tbl_Stock s = new User_Property_Tbl_Stock();
            s.current_stock = "0";
            s.sub_cat_id    = find_sub_cat_id();
            s.l_date        = DateTime.Now.ToShortDateString();
            Insert_Logic.Insert_Stock(s);

            if (i == 1)
            {
                lbl_msg.Text      = "Successfully Inserted";
                lbl_msg.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                lbl_msg.Text      = "Duplicate Data";
                lbl_msg.ForeColor = System.Drawing.Color.Red;
            }
        }
        else
        {
            //update details about sub category
            u.sub_cat_id = id;
            int ii = Update_Logic.Update_Sub_Category(u);
            if (ii == 1)
            {
                Response.Redirect("manage_sub_category.aspx");
            }
            else
            {
                lbl_msg.Text = "Error";
            }
        }


        ModalPopupExtender1.Show();
    }
Ejemplo n.º 8
0
    protected void btn_ok_Click(object sender, EventArgs e)
    {
        User_Property_Tbl_Dealer u = new User_Property_Tbl_Dealer();

        u.d_name          = txt_dealer_name.Text;
        u.d_email_address = txt_dealer_email.Text;
        u.d_location      = txt_dealer_location.Text;
        u.d_contact       = txt_contact_no.Text;

        if (btn_ok.Text == "Add")
        {
            int i = Insert_Logic.Insert_Dealer(u);
            clear();
            if (i == 1)
            {
                lbl_msg.Text      = "Successfully Inserted";
                lbl_msg.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                lbl_msg.Text      = "Duplicate Data";
                lbl_msg.ForeColor = System.Drawing.Color.Red;
            }

            mpe.Show();
        }
        else
        {
            u.d_id = id;
            int ii = Update_Logic.Update_Dealer(u);
            if (ii == 1)
            {
                lbl_msg.Text = "Updated";
                Response.Redirect("manage_dealer.aspx");
            }
            else
            {
                lbl_msg.Text = "Duplicate Data ...!!";
            }
            mpe.Show();
        }



        //if (i == 1)
        //    Response.Write("data successfully inserted");
        //else
        //    Response.Write("data successfully  not inserted");
    }
    protected void btn_ok_Click(object sender, EventArgs e)
    {
        if (txt_current_password.Text == temp_p_db)
        {
            if (txt_new_password.Text == txt_confirm_password.Text)
            {
                User_Property_tbl_user u = new User_Property_tbl_user();
                u.user_name = Session["username"].ToString();
                u.password  = txt_new_password.Text;

                int i = Update_Logic.update_password(u.user_name, u.password);

                if (i == 1)
                {
                    modal_lbl_msg.Text      = "Successfully Changed";
                    modal_lbl_msg.ForeColor = System.Drawing.Color.Green;
                    ModalPopupExtender1.Show();
                }
                else
                {
                    modal_lbl_msg.Text      = "Error";
                    modal_lbl_msg.ForeColor = System.Drawing.Color.Red;
                    ModalPopupExtender1.Show();
                }
            }
            else
            {
                modal_lbl_msg.Text      = "New Password and Confirm password should be same";
                modal_lbl_msg.ForeColor = System.Drawing.Color.Red;
                ModalPopupExtender1.Show();
            }
        }

        else
        {
            modal_lbl_msg.Text      = "Password Does not match";
            modal_lbl_msg.ForeColor = System.Drawing.Color.Red;
            ModalPopupExtender1.Show();
        }
    }
Ejemplo n.º 10
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();
    }
Ejemplo n.º 11
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());
    }
    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();
    }
Ejemplo n.º 13
0
    protected void btn_ok_Click(object sender, EventArgs e)
    {
        User_Property_Tbl_Category u = new User_Property_Tbl_Category();

        u.cat_name = txt_category_name.Text;


        if (fl_category_photo.FileName != "")
        {
            if (fl_category_photo.PostedFile.ContentLength <= 512000)
            {
                string ext = Path.GetExtension(fl_category_photo.FileName).ToLower();

                if (ext == ".jpg" || ext == ".png" || ext == ".gif")
                {
                    Random r = new Random();

                    string f_nm = Path.GetFileNameWithoutExtension(fl_category_photo.FileName);

                    f_nm = f_nm + "_" + r.Next() + ext;

                    fl_category_photo.SaveAs(Server.MapPath("~/Upload/" + f_nm));
                    u.cat_photo = "~/Upload/" + f_nm;
                }
                else
                {
                    lbl_photo_msg.Text    = "Invalid Photo Type";
                    lbl_photo_msg.Visible = true;
                    return;
                }
            }
            else
            {
                lbl_photo_msg.Text    = "Photo Size is To Big";
                lbl_photo_msg.Visible = true;
                return;
            }
        }
        else
        {
            u.cat_photo = "";
        }

        //used when insertion of data
        if (btn_ok.Text == "Add")
        {
            int i = Insert_Logic.Insert_Category(u);
            clear();

            if (i == 1)
            {
                {
                    lbl_msg.Text      = "Successfully Inserted Data";
                    lbl_msg.ForeColor = System.Drawing.Color.Green;
                }
            }
            else
            {
                lbl_msg.Text      = "Data Insertion Failed";
                lbl_msg.ForeColor = System.Drawing.Color.Red;
            }
            mpe.Show();
        }


        //used when update the category data

        else
        {
            u.cat_id = id;

            int ii = Update_Logic.Update_Category(u);
            if (ii == 1)
            {
                Response.Redirect("manage_category.aspx");
            }
            else
            {
                lbl_msg.Text = "error";
                mpe.Show();
            }
        }
    }
Ejemplo n.º 14
0
    //bill generation
    protected void btn_generate_bill_Click(object sender, EventArgs e)
    {
        if (Session["remaining_amount_customer"] != "")
        {
            if (Convert.ToInt32(txt_total_amount.Text) >= Convert.ToInt32(txt_current_pay.Text))
            {
                string bill_no1         = Session["remaining_amount_customer"].ToString();
                string remaining_amount = Convert.ToString(Convert.ToInt32(txt_total_amount.Text) - Convert.ToInt32(txt_current_pay.Text));
                Update_Logic.update_remaining_amount(bill_no1, remaining_amount);
                Response.Redirect("Bill.aspx");
            }
            else
            {
                lbl_msg.Text = "Current Pay should not be Greater than Total Amount";
                mpe.Show();
            }
        }
        else if (Session["Bill_no_customer_page"] != "")
        {
            if (Convert.ToInt32(txt_total_amount.Text) >= Convert.ToInt32(txt_current_pay.Text))
            {
                String bill_no1         = Session["Bill_no_customer_page"].ToString();
                string remaining_amount = Convert.ToString(Convert.ToInt32(txt_total_amount.Text) - Convert.ToInt32(txt_current_pay.Text));
                Update_Logic.update_remaining_amount(bill_no1, remaining_amount);
                Response.Redirect("Bill.aspx");
            }
            else
            {
                lbl_msg.Text = "Current Pay should not be Greater than Total Amount";
                mpe.Show();
            }
        }
        else
        {
            Userr_Property_Tbl_Selling u = new Userr_Property_Tbl_Selling();
            u.bill_no       = Session["bill_no"].ToString();
            u.c_id          = find_customer_id();
            u.total_amount  = txt_total_amount.Text;
            u.purchase_date = txt_purchase_date.Text;
            u.current_pay   = txt_current_pay.Text;

            if ((Convert.ToInt32(u.total_amount)) < (Convert.ToInt32(u.current_pay)))
            {
                amount_error.ForeColor = System.Drawing.Color.Red;
                amount_error.Text      = "current pay should not be greater than total amount";
                return;
            }

            u.remaining_amount = Convert.ToString(Convert.ToInt32(u.total_amount) - Convert.ToInt32(u.current_pay));
            int i = Insert_Logic.Insert_Selling(u);

            if (i == 1)
            {
                Response.Redirect("Bill.aspx");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('Sry Try Again')", true);
            }
            Session["bill_no"] = "";
            Session["id"]      = "";
        }
    }
    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();
    }
Ejemplo n.º 16
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        User_Property_Tbl_Product u = new User_Property_Tbl_Product();

        u.d_id             = ddl_dealer_name.SelectedValue.ToString();
        u.sub_Cat_id       = ddl_sub_category_name.SelectedValue.ToString();
        u.prod_name        = txt_product_name.Text;
        u.prod_description = txt_product_description.Text;

        try
        {
            u.prod_price = (Convert.ToInt32(txt_current_gold_price.Text) * Convert.ToInt32(txt_weight.Text)).ToString();
        }
        catch (FormatException e1)
        {
            error_current_gold_price.Text = "enter proper price";
            return;
        }

        try
        {
            //for checking type of product weight whether is a number or not
            u.prod_weight = txt_weight.Text;
            int d = Convert.ToInt32(txt_current_gold_price.Text);
        }
        catch (FormatException ef)
        {
            error_product_weight.Text      = "enter proper weight";
            error_product_weight.ForeColor = System.Drawing.Color.Red;
            return;
        }

        u.prod_unique_no = txt_generate_unique_no.Text;
        u.prod_quality   = ddl_product_quality.SelectedValue.ToString();
        u.prod_type      = ddl_product_type.SelectedValue.ToString();

        u.purchase_date = txt_purchase_date.Text;

        //find current stock
        // add current stock + 1
        User_Property_Tbl_Stock s = new User_Property_Tbl_Stock();

        s.sub_cat_id    = ddl_sub_category_name.SelectedValue.ToString();
        s.current_stock = (Convert.ToInt32(find_current_stock()) + 1).ToString();
        s.l_date        = DateTime.Now.ToShortDateString().ToString();


        //find stock id for update stock
        s.s_id = find_stock_id();
        if (Button1.Text == "Add")
        {
            int i = Insert_Logic.Insert_Product(u);


            if (s.s_id != "")
            {
                Update_Logic.Update_Stock(s);
            }



            if (i == 1)
            {
                Label3.Text = "inserted";

                Label3.ForeColor = System.Drawing.Color.Green;
                ModalPopupExtender1.Show();
            }
            else
            {
                Label3.Text = "Duplicate data";
                ModalPopupExtender1.Show();
                lbl_msg.ForeColor = System.Drawing.Color.Red;
            }
            ////
        }

        else
        {
            u.p_id = id;
            int ii = Update_Logic.Update_Product(u);
            if (ii == 1)
            {
                Response.Redirect("manage_product.aspx");
            }
            else
            {
                lbl_msg.Text = "Error";
            }
        }
    }