Example #1
0
    public static int Insert_Customer(User_Property_Tbl_Customer u)
    {
        SqlCommand cmd = new SqlCommand();

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

        cmd.Parameters.Add(Create_Parameter.Convert_String("@c_name", u.c_name));
        cmd.Parameters.Add(Create_Parameter.Convert_String("@c_mobile_no", u.c_mobile_no));
        cmd.Parameters.Add(Create_Parameter.Convert_String("@c_email_address", u.c_email_address));
        cmd.Parameters.Add(Create_Parameter.Convert_String("@c_address", u.c_address));

        return(Create_Command.Execute_Non_Query(cmd));
    }
Example #2
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();
    }
    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();
    }