Пример #1
0
        protected void Btn_search_Click(object sender, EventArgs e)
        {
            string category = DropDownList_category.SelectedItem.ToString();

            GridView_stock.DataSource = StoreBusinessLogic.GetStockByCategory(category);
            GridView_stock.DataBind();
        }
Пример #2
0
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string suppcode = Convert.ToString(GridView_supplier.DataKeys[e.RowIndex].Values[0]);

            StoreBusinessLogic.DeleteSupplier(suppcode);
            bindgrid();
        }
Пример #3
0
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string deptcode = Convert.ToString(GridView_department.DataKeys[e.RowIndex].Values[0]);

            StoreBusinessLogic.DeleteDepartment(deptcode);
            bindgrid();
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["sign"].ToString() == "")
            {
                Response.Redirect("~/LoginNew.aspx");
            }
            Boolean results = empauthentication.SupAuthentication(Session["sign"].ToString());

            if (results == false)
            {
                Response.Redirect("~/LoginNew.aspx");
            }
            btn_Notification.Enabled = false;
            int id = (int)Session["id"];

            GridView1.DataSource = StoreBusinessLogic.GetAdjustbYidSuper(id);
            GridView1.DataBind();
            for (int i = 0; i < GridView1.Rows.Count - 1; i++)
            {
                if (GridView1.Rows[i].Cells[7].ToString() == "NULL" || GridView1.Rows[i].Cells[7].ToString() == "")
                {
                    btn_Notification.Enabled = true;
                }
                break;
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["sign"].ToString() == "")
            {
                Response.Redirect("~/LoginNew.aspx");
            }
            if (!IsPostBack)
            {
                List <RequestSTATUS> RequestList = StoreBusinessLogic.GetRetriecvalStatus();
                if (RequestList.Count == 0)
                {
                    lb_Inform.Text = "No Request Now";
                }
                else
                {
                    GridView1.DataSource = StoreBusinessLogic.GetRetriecvalStatus();
                    GridView1.DataBind();
                }
            }
            Boolean results = empauthentication.ClerkAuthentication(Session["sign"].ToString());

            if (results == false)
            {
                Response.Redirect("~/LoginNew.aspx");
            }
        }
Пример #6
0
        //Delete
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            POnum = Convert.ToInt32(TextBox5.Text);
            string itemCode = GridView1.DataKeys[e.RowIndex].Values[0].ToString();

            StoreBusinessLogic.DeleteItem(POnum, itemCode);
            BindGrid(POnum);
        }
Пример #7
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int    RequestID     = 0;
            string Description   = "";
            int    RequestQty    = 0;
            int    CollectionQty = 0;

            try
            {
                if (GridView1.Rows.Count > 0)
                {
                    foreach (GridViewRow row in GridView1.Rows)
                    {
                        RequestID     = Int32.Parse((row.FindControl("Label1") as Label).Text);
                        Description   = (row.FindControl("Label2") as Label).Text;
                        RequestQty    = Int32.Parse((row.FindControl("Label3") as Label).Text);
                        CollectionQty = Int32.Parse((row.FindControl("textbox1") as TextBox).Text);
                        if (CollectionQty > RequestQty || CollectionQty < 0)
                        {
                            Session["count"] = 1;
                        }
                    }
                }
                else
                {
                    lb_Inform.Text = "No Request now";
                }
            }
            catch (Exception ex)
            {
                lb_Inform.Text = "Please input Positive Integer";
            }

            if (Convert.ToInt32(Session["count"]) == 1)
            {
                lb_Inform.Text   = "CollectionQty can not more than RequestQty or be negative";
                Session["count"] = 0;
            }
            else
            {
                try
                {
                    foreach (GridViewRow row in GridView1.Rows)
                    {
                        RequestID     = Int32.Parse((row.FindControl("Label1") as Label).Text);
                        Description   = (row.FindControl("Label2") as Label).Text;
                        RequestQty    = Int32.Parse((row.FindControl("Label3") as Label).Text);
                        CollectionQty = Int32.Parse((row.FindControl("textbox1") as TextBox).Text);
                        StoreBusinessLogic.UpdateOrder(RequestID, Description, RequestQty, CollectionQty);
                    }
                    Response.Redirect("~/StorePage/Retrieval Form.aspx");
                }
                catch (Exception ex)
                {
                    lb_Inform.Text = "Please input Positive Integer";
                }
            }
        }
Пример #8
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (GridView1.Rows.Count > 0)
         {
             foreach (GridViewRow row in GridView1.Rows)
             {
                 int    RequestID       = Int32.Parse((row.FindControl("Label1") as Label).Text);
                 string ItemCode        = (row.FindControl("Label2") as Label).Text;
                 string s               = (row.FindControl("textbox1") as TextBox).Text;
                 string a               = (row.FindControl("Label5") as Label).Text;
                 int    CollectionQty   = Convert.ToInt32(a);
                 int    DisbursementQty = Convert.ToInt32(s);
                 if (DisbursementQty > CollectionQty || DisbursementQty < 0)
                 {
                     Session["count"] = 1;
                 }
             }
         }
         else
         {
             lb_Inform.Text = "No pending Disbursment Now";
         }
     }
     catch (Exception ex)
     {
         lb_Inform.Text  = "Please input Positive Integer";
         Button1.Enabled = true;
     }
     if (Convert.ToInt32(Session["count"]) == 1)
     {
         lb_Inform.Text   = "DisbursementQty can not more than CollectionQty or be negative";
         Session["count"] = 0;
     }
     else
     {
         try
         {
             foreach (GridViewRow row in GridView1.Rows)
             {
                 int    RequestID       = Int32.Parse((row.FindControl("Label1") as Label).Text);
                 string ItemCode        = (row.FindControl("Label2") as Label).Text;
                 string s               = (row.FindControl("textbox1") as TextBox).Text;
                 int    DisbursementQty = Convert.ToInt32(s);
                 StoreBusinessLogic.Disburse(RequestID, ItemCode, DisbursementQty);
             }
             Response.Redirect("~/StorePage/Disbursement List.aspx");
         }
         catch (Exception ex)
         {
             lb_Inform.Text = "Please input Positive Integer";
         }
     }
 }
Пример #9
0
        protected void Btn_add_Click(object sender, EventArgs e)
        {
            string suppcode     = TB_suppCode.Text;
            string suppname     = TB_suppName.Text;
            string contacttitle = TB_contactTitle.Text;
            string contactname  = TB_contactName.Text;
            string phone        = TB_phone.Text;
            string fax          = TB_fax.Text;
            string address      = TB_address.Text;
            string postcode     = TB_postalCode.Text;
            string gst          = TB_gst.Text;

            StoreBusinessLogic.AddNewSupplier(suppcode, suppname, contacttitle,
                                              contactname, phone, fax, address, postcode, gst);
        }
Пример #10
0
        protected void Btn_add_Click(object sender, EventArgs e)
        {
            string deptcode        = TB_deptCode.Text;
            string deptname        = TB_deptName.Text;
            string contactname     = TB_contactName.Text;
            string phone           = TB_phone.Text;
            string fax             = TB_fax.Text;
            string headname        = TB_headName.Text;
            string collectionpoint = TB_collectionPoint.Text;
            string repname         = TB_repName.Text;
            string headtitle       = TB_headTitle.Text;
            string contacttitle    = TB_contactTitle.Text;

            StoreBusinessLogic.AddNewDepartment(deptcode, deptname, contactname, phone,
                                                fax, headname, collectionpoint, repname, contacttitle, headtitle);
            Label1.Text = "Add Successful";
        }
Пример #11
0
        //Place order
        protected void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (GridViewRow row in GridView1.Rows)
                {
                    if (row.Visible == true)
                    {
                        int    POnum    = Convert.ToInt32(Label16.Text);
                        string ItemCode = (row.FindControl("Label7") as Label).Text;
                        string Category = (row.FindControl("Label8") as Label).Text;
                        string desp     = (row.FindControl("Label9") as Label).Text;
                        int    qty      = Convert.ToInt32((row.FindControl("TextBox1") as TextBox).Text);
                        string suppCode = (row.FindControl("Label14") as Label).Text;
                        double price    = Convert.ToDouble((row.FindControl("Label15") as Label).Text);

                        int orderedQty;
                        using (Model1 entities = new Model1())
                        {
                            Stock s = entities.Stocks.Where(p => p.ItemCode == ItemCode).First <Stock>();
                            orderedQty = Convert.ToInt32(s.OrderedQty) + qty;
                        }
                        if (qty >= 0)
                        {
                            StoreBusinessLogic.AddPO(POnum, ItemCode, desp, qty, price, suppCode);
                            StoreBusinessLogic.UpdateStock(ItemCode, orderedQty);
                            PoNo();
                            BindGrid();
                            Label18.Text = "Successful";
                        }
                        else
                        {
                            Label18.Text = "Please input Positive Integer";
                        }
                    }
                }
                PoNo();
                string supp = DropDownList1.SelectedValue.ToString();
                BindGrid(supp);
                Label17.Text = "";
            }
            catch (Exception ex)
            {
                Label18.Text = "Invalid PO number!";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GridView1.DataSource = StoreBusinessLogic.GetAVListMan();
                GridView1.DataBind();
            }
            if (Session["sign"].ToString() == "")
            {
                Response.Redirect("~/LoginNew.aspx");
            }
            Boolean results = empauthentication.ManagerAuthentication(Session["sign"].ToString());

            if (results == false)
            {
                Response.Redirect("~/LoginNew.aspx");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            btn_Notification.Enabled = false;
            int id = (int)Session["id"];

            GridView1.DataSource = StoreBusinessLogic.GetAdjustbYidMang(id);
            GridView1.DataBind();
            if (Session["sign"].ToString() == "")
            {
                Response.Redirect("~/LoginNew.aspx");
            }
            Boolean results = empauthentication.ManagerAuthentication(Session["sign"].ToString());

            if (results == false)
            {
                Response.Redirect("~/LoginNew.aspx");
            }
        }
Пример #14
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Model1 ctx      = new Model1();
            int    avnumber = int.Parse(GridView1.SelectedRow.Cells[1].Text);
            string itemcode = GridView1.SelectedRow.Cells[2].Text;

            StoreBusinessLogic.EditAdjust(avnumber, itemcode, "Approved");
            lab_successful.Text = "Change Successful";
            AdjustmentVoucher A = ctx.AdjustmentVouchers.Where(x => x.AVnumber == avnumber).First();

            A.ABName = Session["sign"].ToString();
            User u = ctx.Users.Where(x => x.UserName == A.ABName).First();

            A.ApproveBy = u.UserID;
            ctx.SaveChanges();
            btn_Notification.Enabled = true;
            Session["CRName"]        = A.CRName;
            Session["content"]       = Session["content"].ToString() + itemcode.ToString() + ",";
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            btn_InformSupplier.Enabled = false;
            if (!IsPostBack)
            {
                GridView_supplier.DataSource = StoreBusinessLogic.AllSupplier();
                GridView_supplier.DataBind();
            }
            if (Session["sign"].ToString() == "")
            {
                Response.Redirect("~/LoginNew.aspx");
            }
            Boolean results = empauthentication.ClerkAuthentication(Session["sign"].ToString());

            if (results == false)
            {
                Response.Redirect("~/LoginNew.aspx");
            }
        }
Пример #16
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row             = GridView_department.Rows[e.RowIndex];
            string      deptcode        = Convert.ToString(GridView_department.DataKeys[e.RowIndex].Values[0]);
            string      deptname        = (row.FindControl("TextBox1") as TextBox).Text;
            string      contacttitle    = (row.FindControl("TextBox2") as TextBox).Text;
            string      contactname     = (row.FindControl("TextBox3") as TextBox).Text;
            string      phone           = (row.FindControl("TextBox4") as TextBox).Text;
            string      fax             = (row.FindControl("TextBox5") as TextBox).Text;
            string      headtitle       = (row.FindControl("TextBox6") as TextBox).Text;
            string      headname        = (row.FindControl("TextBox7") as TextBox).Text;
            string      collectionpoint = (row.FindControl("TextBox8") as TextBox).Text;
            string      repname         = (row.FindControl("TextBox9") as TextBox).Text;

            Departmentcode = deptcode;
            List <string> list = new List <string>()
            {
                deptcode, deptname, contacttitle, contactname, phone, fax, headtitle, headname, collectionpoint,
                repname
            };

            foreach (string c in list)
            {
                if (c == "" || c == null)
                {
                    Session["count"] = 1;
                }
            }
            if (Convert.ToInt32(Session["count"]) == 1)
            {
                Label11.Text     = "Infomation is not complete";
                Session["count"] = 0;
            }
            else
            {
                StoreBusinessLogic.EditDepartment(deptcode, deptname, contactname,
                                                  phone, fax, headname, collectionpoint, repname, contacttitle, headtitle);
                GridView_department.EditIndex = -1;
                bindgrid();
                btn_Inform.Enabled = true;
                Btn_addNew.Enabled = true;
            }
        }
Пример #17
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row          = GridView_supplier.Rows[e.RowIndex];
            string      suppcode     = Convert.ToString(GridView_supplier.DataKeys[e.RowIndex].Values[0]);
            string      suppname     = (row.FindControl("TextBox1") as TextBox).Text;
            string      contacttitle = (row.FindControl("TextBox2") as TextBox).Text;
            string      contactname  = (row.FindControl("TextBox3") as TextBox).Text;
            string      phone        = (row.FindControl("TextBox4") as TextBox).Text;
            string      fax          = (row.FindControl("TextBox5") as TextBox).Text;
            string      address      = (row.FindControl("TextBox6") as TextBox).Text;
            string      postcode     = (row.FindControl("TextBox7") as TextBox).Text;
            string      gst          = (row.FindControl("TextBox8") as TextBox).Text;

            Suppliercode = suppcode;
            List <string> list = new List <string>()
            {
                suppcode, suppname, contacttitle, contactname, phone, fax, address, postcode, gst,
            };

            foreach (string c in list)
            {
                if (c == "" || c == null)
                {
                    Session["count"] = 1;
                }
            }
            if (Convert.ToInt32(Session["count"]) == 1)
            {
                Label10.Text     = "Infomation is not complete";
                Session["count"] = 0;
            }
            else
            {
                StoreBusinessLogic.EditSupplier(suppcode, suppname, contacttitle, contactname,
                                                phone, fax, address, postcode, gst);
                GridView_supplier.EditIndex = -1;
                bindgrid();
                btn_InformSupplier.Enabled = true;
                Btn_addNew.Enabled         = true;
            }
        }
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["sign"].ToString() == "")
            {
                Response.Redirect("~/LoginNew.aspx");
            }
            if (!IsPostBack)
            {
                PoNo();
                //BindGrid();

                DropDownList1.DataSource     = StoreBusinessLogic.ListSupp();
                DropDownList1.DataTextField  = "SuppCode";
                DropDownList1.DataValueField = "SuppCode";
                DropDownList1.DataBind();
            }
            Boolean results = empauthentication.ClerkAuthentication(Session["sign"].ToString());

            if (results == false)
            {
                Response.Redirect("~/LoginNew.aspx");
            }
        }
Пример #19
0
        //Add
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                int    POnum    = Int32.Parse(TextBox5.Text);
                string ItemCode = TextBox1.Text;
                string desp     = DropDownList2.SelectedValue.ToString();
                int    qty      = Int32.Parse(TextBox2.Text);
                double price    = double.Parse(TextBox3.Text);
                string suppCode;

                if (GridView1.Rows.Count <= 0)
                {
                    suppCode = Label8.Text;
                    StoreBusinessLogic.AddPO(POnum, ItemCode, desp, qty, price, suppCode);
                    BindGrid(POnum);
                }
                else
                {
                    PurchaseOrder po = ctx.PurchaseOrders.Where(p => p.POnumber == POnum).First();
                    if (Label8.Text.ToString() == po.SuppCode)
                    {
                        suppCode = Label8.Text;
                        StoreBusinessLogic.AddPO(POnum, ItemCode, desp, qty, price, suppCode);
                        BindGrid(POnum);
                    }
                    else
                    {
                        Label7.Text = "Please add same supplier to one purchaseOrder";
                    }
                }
            }
            catch (Exception ex)
            {
                Label7.Text = "Please Input Valid Quantity";
            }
        }
Пример #20
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            int    DOnum;
            int    POnum;
            string ItemCode;
            string desp;
            int    POQty;
            int    DeliveredQty;
            string suppcode;
            int    currentQty;
            int    orderedQty;

            try
            {
                if (GridView1.Rows.Count > 0)
                {
                    foreach (GridViewRow row in GridView1.Rows)
                    {
                        DOnum        = Convert.ToInt32(TextBox2.Text);
                        POnum        = Convert.ToInt32(TextBox1.Text);
                        ItemCode     = (row.FindControl("Label8") as Label).Text;
                        desp         = (row.FindControl("Label9") as Label).Text;
                        POQty        = Convert.ToInt32((row.FindControl("Label11") as Label).Text);
                        DeliveredQty = Convert.ToInt32((row.FindControl("TextBox4") as TextBox).Text);
                        suppcode     = TextBox3.Text;

                        if (DeliveredQty > POQty || DeliveredQty < 0)
                        {
                            Session["count"] = 1;
                        }
                    }
                }
                else
                {
                    Label17.Text = "Delivery Order Successfully";
                }
            }
            catch (Exception EX)
            {
                Label17.Text = "Invalid DeliveredQty!";
            }
            if (Convert.ToInt32(Session["count"]) == 1)
            {
                Label17.Text     = "Invalid DeliveredQty!";
                Session["count"] = 0;
            }
            else
            {
                try
                {
                    foreach (GridViewRow row in GridView1.Rows)
                    {
                        DOnum        = Convert.ToInt32(TextBox2.Text);
                        POnum        = Convert.ToInt32(TextBox1.Text);
                        ItemCode     = (row.FindControl("Label8") as Label).Text;
                        desp         = (row.FindControl("Label9") as Label).Text;
                        POQty        = Convert.ToInt32((row.FindControl("Label11") as Label).Text);
                        DeliveredQty = Convert.ToInt32((row.FindControl("TextBox4") as TextBox).Text);
                        suppcode     = TextBox3.Text;
                        using (Model1 entities = new Model1())
                        {
                            Stock s = entities.Stocks.Where(p => p.ItemCode == ItemCode).First <Stock>();
                            currentQty = Convert.ToInt32(s.CurrentQty);
                            orderedQty = Convert.ToInt32(s.OrderedQty);
                        }
                        StoreBusinessLogic.AddDO(DOnum, POnum, ItemCode, desp, POQty, DeliveredQty, suppcode);
                        currentQty = currentQty + DeliveredQty;
                        orderedQty = orderedQty - DeliveredQty;
                        StoreBusinessLogic.UpdateStock(ItemCode, currentQty, orderedQty);
                    }
                    Session["count"] = 2;
                    Response.Redirect("Delivered Items.aspx");
                }
                catch (Exception EX)
                {
                    Label17.Text = "Invalid DeliveredQty!";
                }
            }
        }
Пример #21
0
 private void bindgrid()
 {
     GridView_department.DataSource = StoreBusinessLogic.AllDepartment();
     GridView_department.DataBind();
 }
Пример #22
0
 private void bindgrid()
 {
     GridView_supplier.DataSource = StoreBusinessLogic.AllSupplier();
     GridView_supplier.DataBind();
 }
Пример #23
0
 //Gridview
 private void BindGrid(int POnum)
 {
     GridView1.DataSource = StoreBusinessLogic.ListPoBy(POnum);
     GridView1.DataBind();
 }
Пример #24
0
 public ProductController()
 {
     _business = new ProductBusinessLogic();
     _store    = new StoreBusinessLogic();
 }
Пример #25
0
 public StoreController()
 {
     _business = new StoreBusinessLogic();
 }
Пример #26
0
 private void BindGrid(string supp)
 {
     GridView1.DataSource = StoreBusinessLogic.GetPOListAll(supp);
     GridView1.DataBind();
 }