Ejemplo n.º 1
0
 protected void SupplierGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     SupplierGridView.DataSource = SupplierBizLogic.ListSupplier();
     SupplierGridView.PageIndex  = e.NewPageIndex;
     SupplierGridView.DataBind();
     BindGrid();
 }
        private void BindGrid()
        {
            int DeptID = (int)HttpContext.Current.Session["DeptID"];

            DelegationHistoryGridView.DataSource = SupplierBizLogic.FindDelegation2(DeptID).ToList();
            DelegationHistoryGridView.DataBind();
            DelegationScheduleGridView.DataSource = SupplierBizLogic.FindDelegation(DeptID).ToList();
            DelegationScheduleGridView.DataBind();
        }
Ejemplo n.º 3
0
        protected void BindData(int DepID)
        {
            Label2.Text = SupplierBizLogic.FindCollectionByDepID(DepID).EmployeeName.ToString();

            URDropDownList.DataSource = SupplierBizLogic.FindEmpByDepID(DepID);

            URDropDownList.DataTextField  = "Name";
            URDropDownList.DataValueField = "EmployeeID";
            URDropDownList.DataBind();
        }
        protected void DelegationScheduleGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            //adin for page index
            int DeptID = (int)HttpContext.Current.Session["DeptID"];

            DelegationScheduleGridView.DataSource = SupplierBizLogic.FindDelegation(DeptID).ToList();

            DelegationScheduleGridView.PageIndex = e.NewPageIndex;
            DelegationScheduleGridView.DataBind();
        }
 protected void GoButton_Click(object sender, EventArgs e)
 {
     ItemID      = ItemDropDownList.SelectedItem.Value;
     Label1.Text = "Current 1st Priorty Supplier : " + SupplierBizLogic.FindItemSupplierByID(ItemID).P1Supplier;
     Label2.Text = "Current 2nd Priorty Supplier : " + SupplierBizLogic.FindItemSupplierByID(ItemID).P2Supplier;
     Label3.Text = "Current 3rd Priorty Supplier : " + SupplierBizLogic.FindItemSupplierByID(ItemID).P3Supplier;
     Label4.Text = "Select for your updates :";
     Label5.Text = "Select for your updates :";
     Label6.Text = "Select for your updates :";
     Priority1DropDownList.Visible = true;
     Priority2DropDownList.Visible = true;
     Priority3DropDownList.Visible = true;
     UpdateButton.Visible          = true;
 }
Ejemplo n.º 6
0
        protected void SupplierGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row        = SupplierGridView.Rows[e.RowIndex];
            int         SupplierID = Convert.ToInt32(SupplierGridView.DataKeys[e.RowIndex].Values[0]);

            //string name = (row.FindControl("Textbox1") as TextBox).Text;
            string address = (row.FindControl("Textbox2") as TextBox).Text;
            string phone   = (row.FindControl("Textbox3") as TextBox).Text;

            SupplierBizLogic.UpdateSupplier(SupplierID, address, phone);

            SupplierGridView.EditIndex = -1;
            this.BindGrid();
        }
        protected void DelegationScheduleGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int         Id    = Convert.ToInt32(DelegationScheduleGridView.DataKeys[e.RowIndex].Values[0]);
            GridViewRow row   = DelegationScheduleGridView.Rows[e.RowIndex];
            DateTime?   start = SupplierBizLogic.findStartDate(Id);
            DateTime?   end;

            if (start >= DateTime.Now.Date)
            {
                SupplierBizLogic.DeleteDelegation(Id);
                this.BindGrid();
            }
            else
            {
                end = DateTime.Now.Date.AddDays(-1);
                SupplierBizLogic.UpdateDelegation(Id, end);
            }
        }
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            //int DepID = 2001;
            int DepID           = (int)HttpContext.Current.Session["DeptID"];
            int NewCollectionID = Convert.ToInt32(CPRadioButtonList.SelectedValue);

            UserRepCollection updatedDeptURCollection = new UserRepCollection {
            };                                                                     // must declare a variable here first before using it in try block or else not detectable

            try
            {
                updatedDeptURCollection = SupplierBizLogic.UpdateURcollectiontableCollection(DepID, NewCollectionID); // changed this to return a userrepcollection object
                Response.Write("<script>alert('Collection Point updated!');</script>");
            }
            catch (Exception exp)
            {
                Response.Write(exp.ToString());
            }

            // added code below:
            try
            {
                //to clerk
                string        oldCollection = Label1.Text;
                String        from          = "*****@*****.**";
                List <String> toAddress     = MailBizLogic.ClerkEmail();
                String        subject       = String.Format("[Auto Notification] Changes on Collection Point for {0}", updatedDeptURCollection.Department.Description);
                String        body          = String.Format("Collection Point For '{0}' has been changed from '{1}' to '{2}'." +
                                                            "\n\nNote: This is an auto-generated email.  Please do not reply to this email." +
                                                            "\n\nThis email is confidential and may be privileged.If you are not the intended recipient, " +
                                                            "please delete it and notify us immediately; you should not copy or use it for any purpose, " +
                                                            "nor disclose its contents to any other person.\n\nThank you.", updatedDeptURCollection.Department.Description, oldCollection, updatedDeptURCollection.Collection.Location);

                foreach (String to in toAddress)
                {
                    MailBizLogic.sendMail(from, to, subject, body);
                }
                BindData(DepID);
            }
            catch (Exception ex)
            {
                Response.Write("Could not send the e-mail - error: " + ex.Message);
            }
        }
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            int Priority1 = Convert.ToInt32(Priority1DropDownList.SelectedItem.Value);
            int Priority2 = Convert.ToInt32(Priority2DropDownList.SelectedItem.Value);
            int Priority3 = Convert.ToInt32(Priority3DropDownList.SelectedItem.Value);

            try
            {
                ItemID = ItemDropDownList.SelectedItem.Value;
                SupplierBizLogic.UpdateItemSupplier(ItemID, Priority1, Priority2, Priority3);
                //Response.Redirect("Default2.aspx?username="******"<script>alert('Suppliers Priority has been updated !');</script>");
                Label1.Text = "";
                Label2.Text = "";
                Label3.Text = "";
                Label4.Text = "";
                Label5.Text = "";
                Label6.Text = "";
                ItemDropDownList.SelectedIndex = 0;
                Priority1DropDownList.Visible  = false;
                Priority2DropDownList.Visible  = false;
                Priority3DropDownList.Visible  = false;

                //send mail to clerk
                String        from      = "*****@*****.**";
                List <String> toAddress = MailBizLogic.ClerkEmail();
                String        subject   = "[Auto Notification] Item supplier update";
                String        body      = String.Format("Supplier's priority has been changed for item {0}. Check website for further details." +
                                                        "\n\nNote: This is an auto-generated email.  Please do not reply to this email." +
                                                        "\n\nThis email is confidential and may be privileged.If you are not the intended recipient, " +
                                                        "please delete it and notify us immediately; you should not copy or use it for any purpose, " +
                                                        "nor disclose its contents to any other person.\n\nThank you.", ItemID);

                foreach (String to in toAddress)
                {
                    MailBizLogic.sendMail(from, to, subject, body);
                }
            }
            catch (Exception exp)
            {
                Response.Write(exp.ToString());
            }
        }
Ejemplo n.º 10
0
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            int DepID         = (int)HttpContext.Current.Session["DeptID"];
            int NewEmployeeID = Convert.ToInt32(URDropDownList.SelectedValue); //changed from CPRadioButtonList to URDropDownList
            int OldEmployeeID = Convert.ToInt32(SupplierBizLogic.FindCollectionByDepID(DepID).EmployeeID);
            UserRepCollection updatedDeptURCollection = new UserRepCollection {
            };                                                                     // must declare a variable here first before using it in try block or else not detectable

            try
            {
                SupplierBizLogic.UpdateNewURinEmptable(NewEmployeeID);
                SupplierBizLogic.UpdateOldURinEmptable(OldEmployeeID);
                updatedDeptURCollection = SupplierBizLogic.UpdateURcollectiontableUR(DepID, NewEmployeeID);
                Response.Write("<script>alert('User Representative changed!');</script>");
            }
            catch (Exception exp)
            {
                Response.Write(exp.ToString());
            }

            // added code below:
            try
            {
                String        from      = "*****@*****.**";
                List <String> toAddress = MailBizLogic.ClerkEmail();
                String        subject   = String.Format("[Auto Notification] Changes on User Representative for {0}", updatedDeptURCollection.Department.Description);
                String        body      = String.Format("New User Representative For '{0}' has been assigned to {1}." +
                                                        "\n\nNote: This is an auto-generated email.  Please do not reply to this email." +
                                                        "\n\nThis email is confidential and may be privileged.If you are not the intended recipient, " +
                                                        "please delete it and notify us immediately; you should not copy or use it for any purpose, " +
                                                        "nor disclose its contents to any other person.\n\nThank you.", updatedDeptURCollection.Department.Description, updatedDeptURCollection.Employee.Name);

                foreach (String to in toAddress)
                {
                    MailBizLogic.sendMail(from, to, subject, body);
                }
                Label2.Text = SupplierBizLogic.FindCollectionByDepID(DepID).EmployeeName.ToString();
            }
            catch (Exception ex)
            {
                Response.Write("Could not send the e-mail - error: " + ex.Message);
            }
        }
Ejemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (HttpContext.Current.Session["EmpID"] == null)
     {
         Response.Redirect("/Account/Login.aspx");
     }
     else
     {
         if (!this.IsPostBack)
         {
             int EmpID  = (int)HttpContext.Current.Session["EmpID"];
             int DeptID = (int)HttpContext.Current.Session["DeptID"];
             SelectStaffDropDownList.DataSource     = SupplierBizLogic.FindEmpByDepID2(DeptID, EmpID);
             SelectStaffDropDownList.DataTextField  = "Name";
             SelectStaffDropDownList.DataValueField = "EmployeeID";
             SelectStaffDropDownList.DataBind();
         }
     }
 }
Ejemplo n.º 12
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (Label1.Text != "Invalid Selection" && Label2.Text != "Invalid Selection")
            {
                int DeptID = (int)HttpContext.Current.Session["DeptID"];

                int      EmpID = Convert.ToInt32(SelectStaffDropDownList.SelectedValue);
                DateTime start = Convert.ToDateTime(Label1.Text);
                DateTime end   = Convert.ToDateTime(Label2.Text);
                if (SupplierBizLogic.IsDuplicate(DeptID, start, end))
                {
                    Response.Write("<script>alert('The selected dates already assigned !');</script>");
                    Label1.Text            = "";
                    Label2.Text            = "";
                    Label3.Text            = "";
                    Label4.Text            = "";
                    Calendar1.SelectedDate = DateTime.Now.Date;
                    SelectStaffDropDownList.SelectedIndex = 0;
                    DateRadioButtonList.SelectedIndex     = 0;
                    count = 0;
                }
                else
                {
                    SupplierBizLogic.CreateDelegation(EmpID, start, end, DeptID);
                    Response.Write("<script>alert('Job Delegated !');</script>");
                    Label1.Text            = "";
                    Label2.Text            = "";
                    Label3.Text            = "";
                    Label4.Text            = "";
                    Calendar1.SelectedDate = DateTime.Now.Date;
                    SelectStaffDropDownList.SelectedIndex = 0;
                    DateRadioButtonList.SelectedIndex     = 0;
                }
            }
            else
            {
                Response.Write("<script>alert('Invalid Selection');</script>");
            }
        }
Ejemplo n.º 13
0
        protected void AddNewSupButton_Click(object sender, EventArgs e)
        {
            string name  = SupplierName.Text;
            string add   = SupplierAdd.Text;
            string phone = SupplierPhone.Text;

            {
                try
                {
                    SupplierBizLogic.AddSupplier(name, add, phone);
                    //Response.Redirect("Default2.aspx?username="******"<script>alert('New Supplier has been Added!');</script>");
                    SupplierName.Text  = "";
                    SupplierAdd.Text   = "";
                    SupplierPhone.Text = "";

                    //send mail to clerk
                    String        from      = "*****@*****.**";
                    List <String> toAddress = MailBizLogic.ClerkEmail();
                    String        subject   = "[Auto Notification] Added new supplier";
                    String        body      = String.Format("New supplier {0} has been added. Check website for further details." +
                                                            "\n\nNote: This is an auto-generated email.  Please do not reply to this email." +
                                                            "\n\nThis email is confidential and may be privileged.If you are not the intended recipient, " +
                                                            "please delete it and notify us immediately; you should not copy or use it for any purpose, " +
                                                            "nor disclose its contents to any other person.\n\nThank you.", name);

                    foreach (String to in toAddress)
                    {
                        MailBizLogic.sendMail(from, to, subject, body);
                    }
                }
                catch (Exception exp)
                {
                    Response.Write(exp.ToString());
                }
            }
        }
 protected void BindData(int DepID)
 {
     Label1.Text = SupplierBizLogic.FindCollectionByDepID(DepID).CollectionPoint.ToString();
     CPRadioButtonList.SelectedValue = SupplierBizLogic.FindCollectionByDepID(DepID).CollectionPointID.ToString();
 }
Ejemplo n.º 15
0
 private void BindGrid()
 {
     SupplierGridView.DataSource = SupplierBizLogic.ListSupplier();
     SupplierGridView.DataBind();
 }
Ejemplo n.º 16
0
        protected void AddNewButton_Click(object sender, EventArgs e)
        {
            string ItemID           = ItemIdTextBox.Text;
            int    CatID            = Convert.ToInt32(CategoryDropDownList.SelectedItem.Value);
            string Item_Description = DescTextBox.Text;
            string UnitOfMeasure    = UoMTextBox.Text;
            double UnitCost         = Convert.ToDouble(UPTextBox.Text);
            int    Priority1        = Convert.ToInt32(Priority1DropDownList.SelectedItem.Value);
            int    Priority2        = Convert.ToInt32(Priority2DropDownList.SelectedItem.Value);
            int    Priority3        = Convert.ToInt32(Priority3DropDownList.SelectedItem.Value);

            List <String> l     = SupplierBizLogic.ListAllItem();
            Boolean       check = true;

            for (int i = 0; i < l.Count; i++)
            {
                if (ItemID == l[i])
                {
                    check = false;
                }
            }
            if (check == true)
            {
                try
                {
                    SupplierBizLogic.AddItem(ItemID, CatID, Item_Description, UnitOfMeasure, UnitCost, Priority1,
                                             Priority2, Priority3);
                    //Response.Redirect("Default2.aspx?username="******"<script>alert('Item Added to Inventory!');</script>");
                    ItemIdTextBox.Text = "";
                    CategoryDropDownList.SelectedIndex = 0;
                    DescTextBox.Text = "";
                    UoMTextBox.Text  = "";
                    UPTextBox.Text   = "";
                    Priority1DropDownList.SelectedIndex = 0;
                    Priority2DropDownList.SelectedIndex = 0;
                    Priority3DropDownList.SelectedIndex = 0;

                    //send mail to clerk
                    String        from      = "*****@*****.**";
                    List <String> toAddress = MailBizLogic.ClerkEmail();
                    String        subject   = "[Auto Notification] Added new item";
                    String        body      = String.Format("New item - {0} has been added to the inventory. Check inventory for further details." +
                                                            "\n\nNote: This is an auto-generated email.  Please do not reply to this email." +
                                                            "\n\nThis email is confidential and may be privileged.If you are not the intended recipient, " +
                                                            "please delete it and notify us immediately; you should not copy or use it for any purpose, " +
                                                            "nor disclose its contents to any other person.\n\nThank you.", Item_Description);

                    foreach (String to in toAddress)
                    {
                        MailBizLogic.sendMail(from, to, subject, body);
                    }
                }
                catch (Exception exp)
                {
                    Response.Write(exp.ToString());
                }
            }
            else
            {
                Response.Write("<script>alert('Item Already Exist');</script>");
            }
        }