Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //if (txtSelectedLabel.Value == "-1")
     //{
     //    pnlLabelA.Visible = false;
     //    pnlLabelB.Visible = false;
     //}
     if (!Page.IsPostBack && Request.QueryString["tid"] != null)
     {
         AdminController aCont = new AdminController();
         try
         {
             TaskInfo task = aCont.Get_TaskById(Convert.ToInt32(Request.QueryString["tid"]));
             if (task.Id != -1)
             {
                 LibraryItemInfo    lib     = aCont.Get_LibraryItemById(task.LibraryId);
                 WOGroupStationInfo station = aCont.Get_WorkOrderGroupStationById(task.StationId);
                 ddlLabelTapeFormat.SelectedValue = station.DeliveryMethod.Replace("tf_", "");
                 ddlLabelAgency.SelectedValue     = lib.AgencyId.ToString();
                 ddlLabelAdvertiser.SelectedValue = lib.AdvertiserId.ToString();
                 txtLabelTitle.Text             = lib.Title;
                 txtLabelDescription.Text       = lib.ProductDescription;
                 txtLabelISCI.Text              = lib.ISCICode;
                 txtLabelPMTMediaId.Text        = lib.PMTMediaId;
                 txtLabelLength.Text            = lib.MediaLength;
                 ddlLabelStandard.SelectedValue = lib.Standard;
                 txtLabelWOId.Text              = task.WorkOrderId.ToString();
                 txtSelectedLabel.Value         = "-1";
                 txtLabelNumber.Text            = (aCont.getMaxLabelNumber(PortalId) + 1).ToString();
             }
         }
         catch
         {
             lblLabelMessage.Text = "Task Not Found for Label Creation.";
         }
     }
 }
Пример #2
0
 public abstract void Delete_WorkOrderGroupStation(WOGroupStationInfo WorkOrderGroupStation);
Пример #3
0
 public abstract int Add_WorkOrderGroupStation(WOGroupStationInfo WorkOrderGroupStation);
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AdminController aCont = new AdminController();

            if (Tasks.Count() > 0)
            {
                lblWOId.Text           = Tasks[0].WorkOrderId.ToString();
                lblCompletionDate.Text = Tasks[0].DeliveryOrderDateComplete.ToShortDateString();
                if (Tasks[0].CreatedById != -1)
                {
                    UserInfo user = UserController.GetUserById(PortalId, Convert.ToInt32(Tasks[0].CreatedById));
                    lblOrderUser.Text = user.DisplayName;
                }
                lblDeliveryMethod.Text = Tasks[0].DeliveryMethod;
                WorkOrderInfo  wo     = aCont.Get_WorkOrderById(Tasks[0].WorkOrderId);
                AdvertiserInfo billTo = new AdvertiserInfo();
                if (wo.BillToId != -1)
                {
                    billTo = aCont.Get_AdvertiserById(wo.BillToId);
                }
                else
                {
                    billTo = aCont.Get_AdvertiserById(wo.AdvertiserId);
                }
                litBillTo.Text  = billTo.AdvertiserName + "<br />";
                litBillTo.Text += billTo.Address1 + "<br />";
                if (billTo.Address2 != "")
                {
                    litBillTo.Text += billTo.Address2 + "<br />";
                }
                litBillTo.Text += billTo.City + ", " + billTo.State + " " + billTo.Zip + "<br />";
                WOGroupStationInfo wogroupStation = aCont.Get_WorkOrderGroupStationById(Tasks[0].StationId);
                StationInfo        station        = aCont.Get_StationById(wogroupStation.StationId);
                litShipTo.Text  = station.StationName + "<br />";
                litShipTo.Text += station.CallLetter + "<br />";
                litShipTo.Text += station.Address1 + "<br />";
                if (station.Address2 != "")
                {
                    litShipTo.Text += station.Address2 + "<br />";
                }
                if (station.Phone != "")
                {
                    litShipTo.Text += "Tel: " + station.Phone + "<br />";
                }
                if (station.Fax != "")
                {
                    litShipTo.Text += "Fax: " + station.Fax + "<br />";
                }
                if (station.Email != "")
                {
                    litShipTo.Text += "Email: " + station.Email + "<br />";
                }
                if (station.AttentionLine != "")
                {
                    litShipTo.Text += "ATTENTION: " + station.AttentionLine + "<br />";
                }

                litShipTo.Text += station.City + ", " + station.State + " " + station.Zip + "<br />";
                plTasks.Controls.Clear();
                foreach (TaskInfo Task in Tasks)
                {
                    LibraryItemInfo lib = aCont.Get_LibraryItemById(Task.LibraryId);
                    Literal         lit = new Literal();
                    lit.Text = "<div class=\"pmtRow\"><div class=\"pmtCell2 outline\">" + Task.Quantity.ToString() + "</div>";
                    string desc = "";
                    try {
                        desc = Task.Description.Substring(Task.Description.IndexOf("Station:"), (Task.Description.IndexOf(", Delivery Method")) - Task.Description.IndexOf("Station:"));
                    }
                    catch { }
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.Title + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.ProductDescription + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + Task.DeliveryMethod + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.MediaType.ToUpper() + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.Standard + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.MediaLength + "</div></div>";
                    plTasks.Controls.Add(lit);
                }
            }
        }
Пример #5
0
        public string buildRequest(string ticket)
        {
            string req = "";

            string[] custCodes = new string[6] {
                "CUSTOMIZATION 30 MIN", "HD CUSTOMIZATION 30 MIN", "SPOT CUSTOMIZATION", "HD CUSTOMIZATION SPOT", "CUSTOMIZATION 5 MIN", "HD CUSTOMIZATION 5 MIN"
            };
            int custIndex = 2;

            int                i         = 1;
            string             xmlString = "";
            List <InvoiceInfo> invs      = aCont.Get_InvoicesByToSend();

            if (invs.Count > 0)
            {
                xmlString += "<?xml version=\"1.0\" encoding=\"utf-8\"?><?qbxml version=\"6.0\"?><QBXML><QBXMLMsgsRq onError=\"stopOnError\">";
                //build array of xml
                foreach (InvoiceInfo inv in invs)
                {
                    xmlString += "<InvoiceAddRq requestID=\"" + inv.Id.ToString() + "\"><InvoiceAdd>";//
                    List <int> woIds = aCont.Get_WOInsByInvoiceId(inv.Id);
                    if (woIds.Count > 0 && woIds[0] > 0)
                    {
                        WorkOrderInfo  wo1    = aCont.Get_WorkOrderById(woIds[0]);
                        AdvertiserInfo billto = aCont.Get_AdvertiserById(wo1.BillToId);
                        if (billto.Id == -1)
                        {
                            billto = aCont.Get_AdvertiserById(wo1.AdvertiserId);
                        }
                        i++;
                        xmlString += "<CustomerRef><FullName>" + billto.AdvertiserName.Trim().Replace("&", "&#038;") + "</FullName></CustomerRef>";
                        xmlString += "<BillAddress><Addr1>" + billto.AdvertiserName.Trim().Replace("&", "&#038;") + "</Addr1><Addr2>" + billto.Address1.Trim().Replace("&", "&#038;");
                        if (billto.Address2.Trim() != "")
                        {
                            xmlString += " - " + billto.Address2.Trim().Replace("&", "&#038;");
                        }
                        xmlString += "</Addr2><City>" + billto.City.Trim().Replace("&", "&#038;") + "</City><State>" + billto.State.Trim().Replace("&", "&#038;") + "</State><PostalCode>" + billto.Zip.Trim().Replace("&", "&#038;") + "</PostalCode><Country>" + billto.Country.Trim().Replace("&", "&#038;") + "</Country></BillAddress>";
                        string po = wo1.PONumber;
                        if (po == "")
                        {
                            try
                            {
                                po = wo1.Groups[0].LibraryItems[0].PMTMediaId.Replace("&", "&#038;");
                            }
                            catch { }
                        }
                        xmlString += "<PONumber>" + po.Replace("&", "&#038;") + "</PONumber>";
                        if (woIds.Count == 1)
                        {
                            xmlString += "<FOB>WO: " + woIds[0].ToString() + "</FOB>";
                        }
                        else if (woIds.Count > 1)
                        {
                            xmlString += "<FOB>SEE BELOW</FOB>";
                        }
                        xmlString += "<Memo>" + inv.Id.ToString() + "</Memo>";
                        AgencyInfo ag = aCont.Get_AgencyById(wo1.AgencyId);
                        xmlString += "<Other>" + ag.AgencyName.Trim().Replace("&", "&#038;") + "</Other>";
                        foreach (int woId in woIds)
                        {
                            WorkOrderInfo   wo       = aCont.Get_WorkOrderById(woId);
                            List <TaskInfo> tasks    = aCont.Get_TasksByWOId(wo.Id);
                            int             groupId  = -1;
                            bool            groupNew = true;
                            for (int j = 0; j < tasks.Count; j++)
                            {
                                TaskInfo task = tasks[j];
                                if (groupId == -1)
                                {
                                    groupId = task.WOGroupId;
                                }
                                if (task.WOGroupId != groupId)
                                {
                                    groupNew = true;
                                    groupId  = task.WOGroupId;
                                }
                                if (task.DeliveryStatus.ToLower() != "cancelled" && !task.isDeleted)
                                {
                                    if (task.TaskType != GroupTypeEnum.Delivery)
                                    {
                                        WOGroupInfo       group     = aCont.Get_WorkOrderGroupById(task.WOGroupId);
                                        List <QBCodeInfo> servCodes = aCont.FindQBCodesByTask(task.Id, 0, true);
                                        LibraryItemInfo   lib       = aCont.Get_LibraryItemById(task.LibraryId);
                                        MasterItemInfo    master    = new MasterItemInfo();
                                        if (task.TaskType == GroupTypeEnum.Non_Deliverable)
                                        {
                                            master = aCont.Get_MasterItemById(task.MasterId);
                                        }
                                        //foreach (ServiceInfo serv in group.Services)
                                        if (groupNew)
                                        {
                                            foreach (QBCodeInfo code in servCodes)
                                            {
                                                if (task.TaskType != GroupTypeEnum.Non_Deliverable)
                                                {
                                                    xmlString += "<InvoiceLineAdd>";
                                                    xmlString += "<ItemRef><FullName>" + code.QBCode.Replace("&", "&#038;") + "</FullName></ItemRef>";
                                                    xmlString += "<Desc>" + lib.Title.Replace("&", "&#038;"); //code.QBCode.Replace("&", "&#038;");
                                                    if (woIds.Count > 1 && j == 0)
                                                    {
                                                        xmlString += " WO " + wo.Id.ToString();
                                                    }
                                                    xmlString += "</Desc>";
                                                    if (task.Quantity == 0)
                                                    {
                                                        task.Quantity = 1;
                                                    }
                                                    xmlString += "<Quantity>" + group.LibraryItems.Count.ToString() + "</Quantity>";
                                                    xmlString += "<Other1></Other1>";
                                                    xmlString += "<Other2></Other2></InvoiceLineAdd>";
                                                }
                                                else
                                                {
                                                    xmlString += "<InvoiceLineAdd>";
                                                    xmlString += "<ItemRef><FullName>" + code.QBCode.Replace("&", "&#038;") + "</FullName></ItemRef>";
                                                    xmlString += "<Desc>" + master.Title.Replace("&", "&#038;");
                                                    if (woIds.Count > 1 && j == 0)
                                                    {
                                                        xmlString += " WO " + wo.Id.ToString();
                                                    }
                                                    xmlString += "</Desc>";
                                                    if (task.Quantity == 0)
                                                    {
                                                        task.Quantity = 1;
                                                    }
                                                    xmlString += "<Quantity>" + task.Quantity + "</Quantity>";
                                                    xmlString += "<Other1>" + lib.ProductDescription.Trim().Replace("&", "&#038;") + "</Other1>";
                                                    xmlString += "<Other2>" + lib.ISCICode.Trim().Replace("&", "&#038;") + "</Other2></InvoiceLineAdd>";
                                                }
                                            }
                                            groupNew = false;
                                        }
                                    }
                                    if (task.TaskType == GroupTypeEnum.Bundle || task.TaskType == GroupTypeEnum.Delivery || task.TaskType == GroupTypeEnum.Customized)
                                    {
                                        LibraryItemInfo lib  = aCont.Get_LibraryItemById(task.LibraryId);
                                        bool            isHd = lib.MediaType.IndexOf("HD") != -1;
                                        string[]        pcs  = lib.MediaLength.Split(':');
                                        int             secs = 0;
                                        if (pcs.Length == 2)
                                        {
                                            try
                                            {
                                                secs = 60 * Convert.ToInt32(pcs[0]) + Convert.ToInt32(pcs[1]);
                                            }
                                            catch { }
                                        }
                                        if (secs <= 120 && !isHd)
                                        {
                                            custIndex = 2;
                                        }
                                        else if (secs <= 120 && isHd)
                                        {
                                            custIndex = 3;
                                        }
                                        else if (secs >= 1500 && secs <= 1800 && !isHd)
                                        {
                                            custIndex = 0;
                                        }
                                        else if (secs >= 1500 && secs <= 1800 && isHd)
                                        {
                                            custIndex = 1;
                                        }
                                        else if (secs >= 180 && secs <= 300 && !isHd)
                                        {
                                            custIndex = 4;
                                        }
                                        else if (secs >= 180 && secs <= 300 && !isHd)
                                        {
                                            custIndex = 5;
                                        }
                                        xmlString += "<InvoiceLineAdd>";
                                        if (task.TaskType != GroupTypeEnum.Customized)
                                        {
                                            xmlString += "<ItemRef><FullName>" + task.QBCode.Trim().Replace("&", "&#038;") + "</FullName></ItemRef>";
                                        }
                                        else
                                        {
                                            xmlString += "<ItemRef><FullName>" + custCodes[custIndex] + "</FullName></ItemRef>";
                                        }
                                        xmlString += "<Desc>" + lib.Title.Trim().Replace("&", "&#038;");
                                        if (woIds.Count > 1 && j == 0)
                                        {
                                            xmlString += " WO " + wo.Id.ToString();
                                        }
                                        xmlString += "</Desc>";
                                        if (task.Quantity == 0)
                                        {
                                            task.Quantity = 1;
                                        }
                                        xmlString += "<Quantity>" + task.Quantity + "</Quantity>";
                                        xmlString += "<Other1>" + lib.ProductDescription.Trim().Replace("&", "&#038;") + "</Other1>";
                                        if (lib.TapeCode.Trim() == "")
                                        {
                                            xmlString += "<Other2>" + lib.ISCICode.Trim().Replace("&", "&#038;") + "</Other2></InvoiceLineAdd>";
                                        }
                                        else
                                        {
                                            xmlString += "<Other2>" + lib.TapeCode.Trim().Replace("&", "&#038;") + "</Other2></InvoiceLineAdd>";
                                        }
                                        WOGroupStationInfo station = aCont.Get_WorkOrderGroupStationById(task.StationId);
                                        if (station.DeliveryMethod.ToLower().IndexOf("tf_") != -1)
                                        {
                                            //check to see if we need to add shipping
                                            if (station.ShippingMethodId == -1)
                                            {
                                                int            weight = 1;
                                                TapeFormatInfo tape   = aCont.Get_TapeFormatById(Convert.ToInt32(station.DeliveryMethod.Replace("tf_", "")));
                                                if (station.Quantity * tape.Weight > 1.0)
                                                {
                                                    weight = 2;
                                                }
                                                string shippingPrice = "";
                                                if (weight == 1)
                                                {
                                                    if (station.PriorityId == 1)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx1LbPriority"].ToString();
                                                    }
                                                    else if (station.PriorityId == 2)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx1LbStandard"].ToString();
                                                    }
                                                    else if (station.PriorityId == 3)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx1Lb2Day"].ToString();
                                                    }
                                                }
                                                else
                                                {
                                                    if (station.PriorityId == 1)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx2LbPriority"].ToString();
                                                    }
                                                    else if (station.PriorityId == 2)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx2LbStandard"].ToString();
                                                    }
                                                    else if (station.PriorityId == 3)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx2Lb2Day"].ToString();
                                                    }
                                                }
                                                xmlString += "<InvoiceLineAdd><ItemRef><FullName>SHIPPING</FullName></ItemRef><Desc>P" + station.PriorityId.ToString() + " " + weight.ToString() + "LB SHIPPING CHARGE</Desc><Quantity>1</Quantity><Rate>" + shippingPrice + "</Rate></InvoiceLineAdd>";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    xmlString += "</InvoiceAdd></InvoiceAddRq>";
                    //xmlString += "";
                }
                xmlString += "</QBXMLMsgsRq></QBXML>";
                req        = xmlString;
                //}
            }
            return(req);
        }