protected void gvDeliveringOrder_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     string commandName = e.CommandName.ToString().Trim();
     GridViewRow row = gvDeliveringOrder.Rows[Convert.ToInt32(e.CommandArgument)];
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     switch (commandName)
     {
         case "Success":
             {
                 CSMSService.SalespersionConfrimSuccessOrders(Server.HtmlDecode(row.Cells[2].Text));
                 break;
             }
         case "Fail":
             {
                 CSMSService.SalespersionConfrimFailOrders(Server.HtmlDecode(row.Cells[2].Text));
                 string orderid = row.Cells[2].Text;
                 gvOrderDetailTemp.DataSource = CSMSService.SalespersionViewOrderDetail(orderid);
                 gvOrderDetailTemp.DataBind();
                 int numRow = gvOrderDetailTemp.Rows.Count;
                 for (int i = 0; i < numRow; i++)
                 {
                     int productid = int.Parse(gvOrderDetailTemp.Rows[i].Cells[1].Text);
                     int productquantity = int.Parse(gvOrderDetailTemp.Rows[i].Cells[3].Text);
                     CSMSService.SalespersonAddProduct(productid,productquantity);
                 }
                     break;
             }
         default: break;
     }
     LoadOrders();
 }
Exemple #2
0
 public void LoadCusProduct()
 {
     CSMSService.CSMSWebservice CusViewProduct = new CSMSService.CSMSWebservice();
     gvCusProduct.DataSource = CusViewProduct.CustomerLoadProduct();
     gvCusProduct.DataBind();
     notYetOrder = true;
 }
 protected void btnDeny_Click(object sender, EventArgs e)
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     string orderid = lblOderID.Text;
     string s_empid = (string)Session["USERID"];
     int i_emid;
     if (s_empid != null)
     {
         if (!s_empid.Equals(""))
         {
             i_emid = int.Parse(s_empid);
             CSMSService.SalespersionDenyOrders(orderid, i_emid);
             grvOrderDetail.DataSource = null;
             grvOrderDetail.DataBind();
             lblTotalPrice.Text = null;
             btnAccept.Visible = false;
             btnDeny.Visible = false;
             LoadOrders();
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             sb.Append(@"<script type='text/javascript'>");
             sb.Append("$('#myModal1').modal('hide');");
             sb.Append(@"</script>");
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DenyHideModalScript", sb.ToString(), false);
             Response.Redirect(Request.RawUrl);
         }
     }
 }
 protected void btnAccept_Click(object sender, EventArgs e)
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     string orderid = lblOderID.Text;
     string s_empid = (string)Session["USERID"];
     int i_emid;
     if(s_empid!=null)
     {
         if(!s_empid.Equals(""))
         {
             i_emid = int.Parse(s_empid);
             CSMSService.SalespersionAcceptOrders(orderid, i_emid);
             int numRowDetail = grvOrderDetail.Rows.Count;
             for (int i = 0; i < numRowDetail; i++)
             {
                 int productid = int.Parse(grvOrderDetail.Rows[i].Cells[1].Text);
                 int productquantity = int.Parse(grvOrderDetail.Rows[i].Cells[3].Text);
                 CSMSService.SalespersonMinusProduct(productid, productquantity);
             }
             grvOrderDetail.DataSource = null;
             grvOrderDetail.DataBind();
             lblTotalPrice.Text = null;
             LoadOrders();
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             sb.Append(@"<script type='text/javascript'>");
             sb.Append("$('#myModal1').modal('hide');");
             sb.Append(@"</script>");
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AcceptHideModalScript", sb.ToString(), false);
             Response.Redirect(Request.RawUrl);
         }
     }
 }
Exemple #5
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     string username = txtUsername.Text.Trim();
     string password = txtPassword.Text.Trim();
     CSMSService.CSMSWebservice GuestLogin = new CSMSService.CSMSWebservice();
     string []info =  GuestLogin.GuestLogin(username,password);
     if (info!=null)
     {
         Session.Timeout = 60;
         Session.Add("USERID", info[0]);
         Session.Add("USERNAME", info[1]);
         Session.Add("USERROLE", info[2]);
         switch(info[2])
         {
             case "Admin":
                 Response.Redirect("MasterView.aspx");
                 break;
             case "Saleperson":
                 Response.Redirect("SalePersonViewOder.aspx");
                 break;
             case "Manager":
                 Response.Redirect("ManageProduct.aspx");
                 break;
             default:
                 Response.Redirect("Login.aspx");
                 break;
         }
     }
     else
     {
         Response.Redirect("Login.aspx");
     }
 }
 public void loadReport()
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     grvReport.DataSource = CSMSService.AdminViewReport(DateTime.Now.Date, DateTime.Now, "Success");
     grvReport.DataBind();
     lblUsername.Text = (string) Session["USERNAME"];
 }
 public void LoadDropDownList1()
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     DropDownList1.DataSource = CSMSService.ManagerViewCategories();
     DropDownList1.DataValueField = "categoryid";
     DropDownList1.DataTextField = "categoryname";
     DropDownList1.DataBind();
 }
        public void LoadOrders()
        {
            CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
            grvOrderPending.DataSource = CSMSService.SalespersionViewOrders();
            grvOrderPending.DataBind();

            grvOderDelevering.DataSource = CSMSService.SalespersionViewDeliveringOrders();
            grvOderDelevering.DataBind();
            lblUsername.Text = (string)Session["USERNAME"];
        }
 public void AddProduct()
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     bool status = rbtStatus_.SelectedValue == "Available" ? true : false;
     CSMSService.ManagerAddProduct(txtProductName_.Text,
                                     int.Parse(DropDownList1.SelectedValue),
                                     float.Parse(txtImportPrice_.Text),
                                     float.Parse(txtUnitPrice_.Text),
                                     int.Parse(txtProductQuantity_.Text),
                                     status);
 }
        public void LoadAccounts()
        {
            CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
            grvAccount.DataSource = CSMSService.AdminViewAccount();
            grvAccount.DataBind();

            for (int i = 0; i < grvAccount.Rows.Count; i++)
            {
                grvAccount.Rows[i].Cells[15].Text = grvAccount.Rows[i].Cells[15].Text.Trim().ToUpper() == "TRUE" ? "Available" : "Not Available";
            }
        }
        public void LoadProducts()
        {
            CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
            grvProduct.DataSource = CSMSService.ManagerViewProducts();
            grvProduct.DataBind();

            for (int i = 0; i < grvProduct.Rows.Count; i++)
            {
                grvProduct.Rows[i].Cells[6].Text = grvProduct.Rows[i].Cells[6].Text.Trim().ToUpper() == "TRUE" ? "Available" : "Not Available";
            }
        }
    public void LoadProducts()
    {
        CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
        gvProducts.DataSource = CSMSService.ManagerViewProducts();
        gvProducts.DataBind();

        DataTable dt = CSMSService.ManagerLoadCategories();
        ddlCategories.DataSource = dt;
        ddlCategories.DataTextField = "categoryname";
        ddlCategories.DataValueField = "categoryid";
        ddlCategories.DataBind();
    }
 public void UpdateProduct()
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     bool status = rbtStatus.SelectedValue == "Available" ? true : false;
     CSMSService.ManagerUpdateProduct(int.Parse(txtProductID.Text),
                                         txtProductName.Text,
                                         int.Parse(txtCategoryID.Text),
                                         float.Parse(txtImportPrice.Text),
                                         float.Parse(txtUnitPrice.Text),
                                         int.Parse(txtProductQuantity.Text),
                                         status);
 }
 protected void btnDeny_Click(object sender, EventArgs e)
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     CSMSService.SalespersionDenyOrders(gvOrderDetail.Rows[0].Cells[0].Text);
     gvOrderDetail.DataSource = null;
     gvOrderDetail.DataBind();
     btnAccept.Visible = false;
     btnDeny.Visible = false;
     LoadOrders();
     lblTotalPrice.Text = null;
     lblOrderDetail.Text = null;
 }
Exemple #15
0
    public void CusOrder()
    {
        order.OrderAddress = txtCusAddress.Text;
        order.CusPhone = txtCusPhone.Text;
        CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
        CSMSService.CustomerAddOrder(order.CustOrderCode, order.OrderDate,
                                        order.OrderAddress, order.getTotal(), order.CusPhone);

        foreach (Product p in order.Products)
        {
            CSMSService.CustomerInsertOrderDetail(order.CustOrderCode, p.ProductID, p.ProductPrice, p.ProductQuantity);
        }
    }
    public void LoadOrders()
    {
        CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
        gvOrders.DataSource = CSMSService.SalespersionViewOrders();
        gvOrders.DataBind();

        gvDeliveringOrder.DataSource = CSMSService.SalespersionViewDeliveringOrders();
        gvDeliveringOrder.DataBind();
        if (gvDeliveringOrder.Rows.Count > 0)
        {
            lblDeliveringOrder.Visible = true;
        }
        else
        {
            lblDeliveringOrder.Visible = false;
        }
    }
 public void addAccount()
 {
     float salary = float.Parse(txtEmpSalary.Text);
     int hourswork = int.Parse(txtEmpHoursWork.Text);
     int mgrid = int.Parse(txtEmpMgrID.Text);
     int id = int.Parse(txtEmpCode.Text);
     bool status = false;
     if(rdoPriceRange.SelectedValue.Equals("True")){
         status = true;
     }else
     {
         status = false;
     }
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     CSMSService.AdminAddNewAccount(id, txtEmpName.Text, txtEmpUsername.Text, txtEmpPassword.Text,
         txtEmpRole.Text, txtEmpSex.Text, txtEmpBrithdate.Text, txtEmpHiredate.Text, txtEmpAddress.Text,
         txtEmpPhone.Text, txtEmpCity.Text, txtEmpCountry.Text, salary, hourswork, mgrid, status);
 }
 protected void btnAccept_Click(object sender, EventArgs e)
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     string orderid = gvOrderDetail.Rows[0].Cells[0].Text;
     CSMSService.SalespersionAcceptOrders(orderid);
     int numRowDetail = gvOrderDetail.Rows.Count;
     for (int i = 0; i < numRowDetail; i++)
     {
         int productid = int.Parse(gvOrderDetail.Rows[i].Cells[1].Text);
         int productquantity = int.Parse(gvOrderDetail.Rows[i].Cells[3].Text);
         CSMSService.SalespersonMinusProduct(productid,productquantity);
     }
         gvOrderDetail.DataSource = null;
     gvOrderDetail.DataBind();
     LoadOrders();
     lblTotalPrice.Text = null;
     lblOrderDetail.Text = null;
     btnAccept.Visible = false;
     btnDeny.Visible = false;
 }
        public void AddAccount()
        {
            CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
            bool status = rbtStatus_.SelectedValue == "Available" ? true : false;

            CSMSService.AdminAddNewAccount(txtEmpName_.Text,
                                            txtEmpUsername_.Text,
                                            txtEmpPassword_.Text,
                                            DropDownList2.SelectedItem.ToString(),
                                            rbtSex_.SelectedValue,
                                            txtEmpBirthdate_.Text,
                                            txtEmpHiredate_.Text,
                                            txtEmpAddress_.Text,
                                            txtEmpPhone_.Text,
                                            txtEmpCity_.Text,
                                            txtEmpCountry_.Text,
                                            float.Parse(txtEmpSalary_.Text),
                                            int.Parse(txtEmpHourWork_.Text),
                                            int.Parse(txtEmpMgrID_.Text),
                                            status);
        }
    public void UpdateProduct()
    {
        int productid = int.Parse(txtProductID.Text);
        int categoryid = int.Parse(ddlCategories.SelectedValue);
        float importpirce = float.Parse(txtProductImportPrice.Text);
        float unitprice = float.Parse(txtProductUnitPrice.Text);
        int quantity = int.Parse(txtProductQuantity.Text);
        bool status = false;
        if (rdoProductStatus.SelectedValue.Equals("True"))
        {
            status = true;
        }
        else
        {
            status = false;
        }

        CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
        CSMSService.ManagerUpdateProduct(productid, txtProductName.Text, categoryid,
                                      importpirce, unitprice, quantity, status);
    }
 protected void grvReport_SelectedIndexChanged(object sender, EventArgs e)
 {
     GridViewRow r = grvReport.SelectedRow;
     string orderid = Server.HtmlDecode(r.Cells[0].Text);
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     grvOrderDetail.DataSource = CSMSService.SalespersionViewOrderDetail(orderid);
     grvOrderDetail.DataBind();
     int numRowDetail = grvOrderDetail.Rows.Count;
     float totalPrice = 0;
     for (int i = 0; i < numRowDetail; i++)
     {
         totalPrice = totalPrice + (float.Parse(grvOrderDetail.Rows[i].Cells[3].Text)
                                 * float.Parse(grvOrderDetail.Rows[i].Cells[4].Text));
     }
      lblTotalPrice.Text = "Total: " + totalPrice.ToString();
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     sb.Append(@"<script type='text/javascript'>");
     sb.Append("$('#myModal').modal('show');");
     sb.Append(@"</script>");
     ScriptManager.RegisterStartupScript(this, this.GetType(), "DetailModalScript", sb.ToString(), false);
 }
 public void loadReport()
 {
     string s_empid = (string)Session["USERID"];
     int i_emid;
     if (s_empid != null)
     {
         if (!s_empid.Equals(""))
         {
             i_emid = int.Parse(s_empid);
             CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
             grvOrderReport.DataSource = CSMSService.SalePersonViewReport(i_emid, DateTime.Now.Date, DateTime.Now);
             grvOrderReport.DataBind();
             int numRowReport = grvOrderReport.Rows.Count;
             float total = 0;
             for (int i = 0; i < numRowReport; i++)
             {
                 total += float.Parse(grvOrderReport.Rows[i].Cells[4].Text);
             }
             lblDayTotal.Text = " Total: " + total.ToString();
             lblUsername.Text = (string)Session["USERNAME"];
         }
     }
 }
 public void UpdateCategory()
 {
     int categoryid = int.Parse(txtCategoryID.Text);
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     CSMSService.ManagerUpdateCategories(categoryid, txtCategoryName.Text, txtCategoryDescription.Text);
 }
 public void LoadCategories()
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     grvCategories.DataSource = CSMSService.ManagerViewCategories();
     grvCategories.DataBind();
 }
 public void DelteCategory()
 {
     int categoryid = int.Parse(txtCategoryID.Text);
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     CSMSService.ManagerDeleteCategories(categoryid);
 }
 public void AddCategory()
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     CSMSService.ManagerAddCategories(txtCategoryName1.Text, txtCategoryDescription1.Text);
 }
 protected void gvOrders_SelectedIndexChanged(object sender, EventArgs e)
 {
     GridViewRow r = gvOrders.SelectedRow;
     string orderid = Server.HtmlDecode(r.Cells[1].Text);
     lblOrderDetail.Text = "Order" + orderid + "Detail";
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     gvOrderDetail.DataSource = CSMSService.SalespersionViewOrderDetail(orderid);
     gvOrderDetail.DataBind();
     int numRowDetail = gvOrderDetail.Rows.Count;
     float totalPrice = 0;
     for (int i = 0; i < numRowDetail; i++)
     {
         totalPrice = totalPrice + (float.Parse(gvOrderDetail.Rows[i].Cells[3].Text)
                                 * float.Parse(gvOrderDetail.Rows[i].Cells[4].Text));
     }
     lblTotalPrice.Text = "Total: " + totalPrice.ToString();
     btnAccept.Visible = true;
     btnDeny.Visible = true;
 }
 public void deleteAccount()
 {
     int id = int.Parse(txtEmpCode.Text);
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     CSMSService.AdminDeleteAccount(id);
 }
 public void LoadEmployees()
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     gvEmployees.DataSource = CSMSService.AdminViewAccount();
     gvEmployees.DataBind();
 }
 public void DeleteProduct()
 {
     CSMSService.CSMSWebservice CSMSService = new CSMSService.CSMSWebservice();
     CSMSService.ManagerDeleteProduct(int.Parse(txtProductID.Text));
 }