//to raise request
        protected void RaiseVouReqButton_Click(object sender, EventArgs e)
        {
            BindGrid();
            if (RaiseVouReqGridView.Rows.Count != 0)
            {
                int EmpID = (int)HttpContext.Current.Session["EmpID"];

                VoucherBizLogic.CreateVoucher(EmpID);

                //mail supervisor
                String        from      = "*****@*****.**";
                List <String> toAddress = MailBizLogic.SupervisorEmail();
                String        subject   = "[Auto Notification] New Voucher Request";
                String        body      = String.Format("New Voucher Request has been raised by Employee {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.", EmpID);

                foreach (String to in toAddress)
                {
                    MailBizLogic.sendMail(from, to, subject, body);
                }

                Response.Redirect("~/Views/PendingVouchers.aspx");
            }
            else
            {
                RaiseVouReqButton.Visible = false;
                Response.Write("<script>alert('No voucher items to add');</script>");
            }
        }
        protected void ManagerAppButton_Click(object sender, EventArgs e)
        {
            int count = 0;

            foreach (GridViewRow row in AdjVouDetailsGridView.Rows)
            {
                int voucherId = (int)AdjVouDetailsGridView.DataKeys[row.RowIndex].Values["VoucherID"];
                AdjustmentBizLogic.UpdateStatus(voucherId, count);
                count++;
            }

            //mail to manager
            String        from      = "*****@*****.**";
            List <String> toAddress = MailBizLogic.ManagerEmail();
            String        subject   = "[Auto Notification] Voucher Status";
            String        body      = String.Format("Adjustment Voucher has been moved to your notice, as the amount of item is more than $250." +
                                                    "\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.");

            foreach (String to in toAddress)
            {
                MailBizLogic.sendMail(from, to, subject, body);
            }

            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Routed to Manager for approval');window.location ='SupervisorAdjVou.aspx';", true);
        }
        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());
            }
        }
Exemplo n.º 5
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);
            }
        }
        protected void ButtonSubmitRequest_Click(object sender, EventArgs e)
        {
            int EmpID  = (int)HttpContext.Current.Session["EmpID"];
            int DeptID = (int)HttpContext.Current.Session["DeptID"];

            RequestBizLogic.SubmitRequest(EmpID);//hardcord for testing
            GridViewCartBindGrid();
            Response.Write("<script>alert('Request Submitted Successfully !');</script>");

            //send mail to DH (String)HttpContext.Current.Session["Email"];
            String from    = "*****@*****.**";
            String to      = MailBizLogic.DeptHeadEmail(DeptID);
            String subject = "[Auto Notification] New Request";
            String body    = String.Format("New Request by {0} has been raised. Check website for further deatils." +
                                           "\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.", EmpID);

            MailBizLogic.sendMail(from, to, subject, body);
        }
Exemplo n.º 7
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());
                }
            }
        }
Exemplo n.º 8
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>");
            }
        }