Exemplo n.º 1
0
        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            Staff clk = (Staff)Session["LoginStaff"];
            Dictionary <string, string> orderIDMap = new Dictionary <string, string>();

            if (Session["SupMap"] != null)
            {
                orderIDMap = (Dictionary <string, string>)Session["SupMap"];
            }

            string clerkID = clk.Staff_ID;

            if (orderIDMap.ContainsKey("ALPA"))
            {
                if (orderIDMap["ALPA"] != "fail")
                {
                    List <ItemWithQtyModel> ALPAList = (List <ItemWithQtyModel>)Session["ALPAList"];
                    POC.NewPurchaseOrder(orderIDMap["ALPA"], "ALPA", clerkID);
                    POC.NewPurchaseOrderDetail(orderIDMap["ALPA"], "ALPA", ALPAList);
                    PurchaseOrderPDFController POPDF = new PurchaseOrderPDFController();
                    POPDF.MakePurchaseOrderPDF("ALPA", orderIDMap["ALPA"], DateTime.Today.AddDays(7).ToString("yyyy-MM-dd"), clerkID, ALPAList);
                    PurchaseOrderMailController POM = new PurchaseOrderMailController();
                    POM.email_send(POM.GetSupplierEmail("ALPA"), "C:\\inetpub\\wwwroot\\LogicUniversity\\PDF\\Logic University Purchase Order_" + orderIDMap["ALPA"] + ".pdf");
                }
            }

            if (orderIDMap.ContainsKey("BANE"))
            {
                if (orderIDMap["BANE"] != "fail")
                {
                    List <ItemWithQtyModel> BANEList = (List <ItemWithQtyModel>)Session["BANEList"];
                    POC.NewPurchaseOrder(orderIDMap["BANE"], "BANE", clerkID);
                    POC.NewPurchaseOrderDetail(orderIDMap["BANE"], "BANE", BANEList);
                    PurchaseOrderPDFController POPDF = new PurchaseOrderPDFController();
                    POPDF.MakePurchaseOrderPDF("BANE", orderIDMap["BANE"], DateTime.Today.AddDays(7).ToString("yyyy-MM-dd"), clerkID, BANEList);
                    PurchaseOrderMailController POM = new PurchaseOrderMailController();
                    POM.email_send(POM.GetSupplierEmail("BANE"), "C:\\inetpub\\wwwroot\\LogicUniversity\\PDF\\Logic University Purchase Order_" + orderIDMap["BANE"] + ".pdf");
                }
            }

            if (orderIDMap.ContainsKey("CHEP"))
            {
                if (orderIDMap["CHEP"] != "fail")
                {
                    List <ItemWithQtyModel> CHEPList = (List <ItemWithQtyModel>)Session["CHEPList"];
                    POC.NewPurchaseOrder(orderIDMap["CHEP"], "CHEP", clerkID);
                    POC.NewPurchaseOrderDetail(orderIDMap["CHEP"], "CHEP", CHEPList);
                    PurchaseOrderPDFController POPDF = new PurchaseOrderPDFController();
                    POPDF.MakePurchaseOrderPDF("CHEP", orderIDMap["CHEP"], DateTime.Today.AddDays(7).ToString("yyyy-MM-dd"), clerkID, CHEPList);
                    PurchaseOrderMailController POM = new PurchaseOrderMailController();
                    POM.email_send(POM.GetSupplierEmail("CHEP"), "C:\\inetpub\\wwwroot\\LogicUniversity\\PDF\\Logic University Purchase Order_" + orderIDMap["CHEP"] + ".pdf");
                }
            }

            if (orderIDMap.ContainsKey("OMEG"))
            {
                if (orderIDMap["OMEG"] != "fail")
                {
                    List <ItemWithQtyModel> OMEGList = (List <ItemWithQtyModel>)Session["OMEGList"];
                    POC.NewPurchaseOrder(orderIDMap["OMEG"], "OMEG", clerkID);
                    POC.NewPurchaseOrderDetail(orderIDMap["OMEG"], "OMEG", OMEGList);
                    PurchaseOrderPDFController POPDF = new PurchaseOrderPDFController();
                    POPDF.MakePurchaseOrderPDF("OMEG", orderIDMap["OMEG"], DateTime.Today.AddDays(7).ToString("yyyy-MM-dd"), clerkID, OMEGList);
                    PurchaseOrderMailController POM = new PurchaseOrderMailController();
                    POM.email_send(POM.GetSupplierEmail("OMEG"), "C:\\inetpub\\wwwroot\\LogicUniversity\\PDF\\Logic University Purchase Order_" + orderIDMap["OMEG"] + ".pdf");
                }
            }

            Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('Orders submitted success! ')</script>");

            Panelcontrol.Visible = false;
            PanelMain.Visible    = true;
            Panel1.Visible       = false;
            Panel2.Visible       = false;
            Panel3.Visible       = false;
            Panel4.Visible       = false;

            PostBack();
        }
Exemplo n.º 2
0
        //need change
        //protected void IBCalendar_Click(object sender, ImageClickEventArgs e)
        //{
        //    if (Calendar1.Visible == false)
        //        Calendar1.Visible = true;
        //    else
        //        Calendar1.Visible = false;
        //}

        ////need change
        //protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        //{
        //    TbEDD.Text = Calendar1.SelectedDate.ToString("yyyy-MM-dd");
        //    Calendar1.Visible = false;
        //}

        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            Staff clerk = (Staff)Session["LoginStaff"];
            Dictionary <string, string> orderIDMap = new Dictionary <string, string>();

            if (Session["SupMap"] != null)
            {
                orderIDMap = (Dictionary <string, string>)Session["SupMap"];
            }

            string clerkID = clerk.Staff_ID;

            if (orderIDMap.ContainsKey("ALPA"))
            {
                if (orderIDMap["ALPA"] != "fail")
                {
                    List <ItemWithQtyModel> ALPAList = (List <ItemWithQtyModel>)Session["ALPAList"];
                    POC.NewPurchaseOrder(orderIDMap["ALPA"], "ALPA", clerkID, TbEDD.Text);
                    POC.NewPurchaseOrderDetail(orderIDMap["ALPA"], "ALPA", ALPAList);
                    PurchaseOrderPDFController POPDF = new PurchaseOrderPDFController();
                    POPDF.MakePurchaseOrderPDF("ALPA", orderIDMap["ALPA"], TbEDD.Text, clerkID, ALPAList);
                    PurchaseOrderMailController POM = new PurchaseOrderMailController();
                    POM.email_send(POM.GetSupplierEmail("ALPA"), "C:\\inetpub\\wwwroot\\LogicUniversity\\PDF\\Logic University Purchase Order_" + orderIDMap["ALPA"] + ".pdf");
                }
            }

            if (orderIDMap.ContainsKey("BANE"))
            {
                if (orderIDMap["BANE"] != "fail")
                {
                    List <ItemWithQtyModel> BANEList = (List <ItemWithQtyModel>)Session["BANEList"];
                    POC.NewPurchaseOrder(orderIDMap["BANE"], "BANE", clerkID, TbEDD.Text);
                    POC.NewPurchaseOrderDetail(orderIDMap["BANE"], "BANE", BANEList);
                    PurchaseOrderPDFController POPDF = new PurchaseOrderPDFController();
                    POPDF.MakePurchaseOrderPDF("BANE", orderIDMap["BANE"], TbEDD.Text, clerkID, BANEList);
                    PurchaseOrderMailController POM = new PurchaseOrderMailController();
                    POM.email_send(POM.GetSupplierEmail("BANE"), "C:\\inetpub\\wwwroot\\LogicUniversity\\PDF\\Logic University Purchase Order_" + orderIDMap["BANE"] + ".pdf");
                }
            }

            if (orderIDMap.ContainsKey("CHEP"))
            {
                if (orderIDMap["CHEP"] != "fail")
                {
                    List <ItemWithQtyModel> CHEPList = (List <ItemWithQtyModel>)Session["CHEPList"];
                    POC.NewPurchaseOrder(orderIDMap["CHEP"], "CHEP", clerkID, TbEDD.Text);
                    POC.NewPurchaseOrderDetail(orderIDMap["CHEP"], "CHEP", CHEPList);
                    PurchaseOrderPDFController POPDF = new PurchaseOrderPDFController();
                    POPDF.MakePurchaseOrderPDF("CHEP", orderIDMap["CHEP"], TbEDD.Text, clerkID, CHEPList);
                    PurchaseOrderMailController POM = new PurchaseOrderMailController();
                    POM.email_send(POM.GetSupplierEmail("CHEP"), "C:\\inetpub\\wwwroot\\LogicUniversity\\PDF\\Logic University Purchase Order_" + orderIDMap["CHEP"] + ".pdf");
                }
            }

            if (orderIDMap.ContainsKey("OMEG"))
            {
                if (orderIDMap["OMEG"] != "fail")
                {
                    List <ItemWithQtyModel> OMEGList = (List <ItemWithQtyModel>)Session["OMEGList"];
                    POC.NewPurchaseOrder(orderIDMap["OMEG"], "OMEG", clerkID, TbEDD.Text);
                    POC.NewPurchaseOrderDetail(orderIDMap["OMEG"], "OMEG", OMEGList);
                    PurchaseOrderPDFController POPDF = new PurchaseOrderPDFController();
                    POPDF.MakePurchaseOrderPDF("OMEG", orderIDMap["OMEG"], TbEDD.Text, clerkID, OMEGList);
                    PurchaseOrderMailController POM = new PurchaseOrderMailController();
                    POM.email_send(POM.GetSupplierEmail("OMEG"), "C:\\Users\\hnin\\Documents\\ADPDF\\Logic University Purchase Order_" + orderIDMap["OMEG"] + ".pdf");
                }
            }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('Orders submitted success! ')</script>");

            PanelContorl.Visible     = false;
            PanelCreateOrder.Visible = true;
            PanelSup1.Visible        = false;
            PanelSup2.Visible        = false;
            PanelSup3.Visible        = false;
            PanelSup4.Visible        = false;
            PostBack();
            //need add email sending code
        }