private void printLabel(LabelInfo label) { AdminController aCont = new AdminController(); TapeFormatInfo tf = aCont.Get_TapeFormatById(label.TapeFormat); if (tf.Label == "A") { pnlLabelA.Visible = true; pnlLabelB.Visible = false; Literal lit = new Literal(); lit.ID = "labelALit_" + label.Id.ToString(); lit.Text = "<div class=\"LabelA\">"; lit.Text += "<div class=\"customerA labelBox\">" + label.AdvertiserName + "<br /></div>"; lit.Text += "<div class=\"buyerA labelBox\">" + label.AgencyName + "<br /></div>"; lit.Text += "<div class=\"titleA labelBox\">" + label.Title + "<br /></div>"; lit.Text += "<div class=\"tapecodeA labelBox\">Tape Code: " + tf.TapeFormat + "</div>"; lit.Text += "<div class=\"descA labelBox\">" + label.Description + "<br /></div>"; lit.Text += "<div class=\"isciA labelBox\">" + label.ISCICode + "<br /></div>"; lit.Text += "<div class=\"masterIdA labelBox\">" + label.PMTMediaId + "<br /></div>"; lit.Text += "<div class=\"spineA labelBox\">" + label.AdvertiserName + "<br /><br />" + label.Title + "<br /><br />ISCI<br />" + label.ISCICode + "<br /><br />" + label.Description + "<br /><br />" + label.PMTMediaId + "<br />" + label.MediaLength + " " + label.Standard + "</div>"; lit.Text += "<div class=\"boxFrontA labelBox\">" + label.AdvertiserName + "<br />" + label.AgencyName + "<br />" + label.Title + "<br />Tape Code: " + tf.TapeFormat + " " + label.Description + "<br />ISCI: " + label.ISCICode + "<br /><br /><br />" + label.PMTMediaId + " " + DateTime.Now.ToShortDateString() + "<br />" + label.MediaLength + " " + label.Standard + "<br />" + label.LabelNumber.ToString() + " WO# " + label.CampaignId + "</div>"; lit.Text += "</div>"; pnlLabelA.Controls.Add(lit); } else if (tf.Label == "B") { pnlLabelA.Visible = false; pnlLabelB.Visible = true; Literal lit = new Literal(); lit.ID = "labelBLit_" + label.Id.ToString(); lit.Text = "<div class=\"LabelB\">"; lit.Text += "<div class=\"DVDTLB labelBox\">" + label.PMTMediaId + "<br />" + label.MediaLength + "<br />" + label.Standard + "</div>"; UserInfo csr = UserController.GetUserById(PortalId, label.CreatedById); lit.Text += "<div class=\"DVDTRB labelBox\">" + label.LabelNumber.ToString() + "<br />" + csr.DisplayName + "<br />" + label.DateCreated.ToShortDateString() + "</div>"; lit.Text += "<div class=\"DVDBottB labelBox\">" + label.AdvertiserName + "<br />" + label.AgencyName + "<br />" + label.Title + "<br />" + label.Description + " " + label.ISCICode + "<br />" + "</div></div>"; pnlLabelB.Controls.Add(lit); } }
public abstract void Delete_TapeFormat(TapeFormatInfo TapeFormat);
public abstract void Update_TapeFormat(TapeFormatInfo TapeFormat);
public abstract int Add_TapeFormat(TapeFormatInfo TapeFormat);
protected void gvLabel_SelectedIndexChanged(object sender, System.EventArgs e) { FillLabelList(); AdminController aCont = new AdminController(); txtSelectedLabel.Value = (gvLabel.SelectedRow.FindControl("hdngvLabelId") as HiddenField).Value; LabelInfo Label = aCont.Get_LabelById(Convert.ToInt32(txtSelectedLabel.Value)); if (Label.Id != -1) { btnDeleteLabel.Enabled = true; btnSaveLabelAs.Enabled = true; txtLabelCreatedBy.Value = Label.CreatedById.ToString(); txtLabelCreatedDate.Value = Label.DateCreated.Ticks.ToString(); ddlLabelTapeFormat.SelectedValue = Label.TapeFormat.ToString(); if (Label.AgencyId > -1) { ddlLabelAgency.SelectedValue = Label.AgencyId.ToString(); } else { if (ddlLabelAgency.SelectedIndex >= 0) { ddlLabelAgency.Items[ddlLabelAgency.SelectedIndex].Selected = false; } try { ddlLabelAgency.Items.FindByText(Label.AgencyName).Selected = true; } catch { } } if (Label.AdvertiserId > -1) { ddlLabelAdvertiser.SelectedValue = Label.AdvertiserId.ToString(); } else { if (ddlLabelAdvertiser.SelectedIndex >= 0) { ddlLabelAdvertiser.Items[ddlLabelAdvertiser.SelectedIndex].Selected = false; } try { ddlLabelAdvertiser.Items.FindByText(Label.AdvertiserName).Selected = true; } catch { } } txtLabelTitle.Text = Label.Title; txtLabelDescription.Text = Label.Description; txtLabelISCI.Text = Label.ISCICode; txtLabelPMTMediaId.Text = Label.PMTMediaId; txtLabelLength.Text = Label.MediaLength; ddlLabelStandard.SelectedValue = Label.Standard; txtLabelNotes.Text = Label.Notes; txtLabelNumber.Text = Label.LabelNumber.ToString(); txtLabelWOId.Text = Label.CampaignId.ToString(); lblLabelMessage.Text = ""; //populate and show actual label litLabelAdvertiser.Text = Label.AdvertiserName; litLabelAgency.Text = Label.AgencyName; litLabelCampaignCreated.Text = ""; //add value when campaigns are added litLabelCampaignId.Text = Label.CampaignId.ToString(); litLabelCampaignStatus.Text = ""; //add value when campaigns are added litLabelDescription.Text = Label.Description; litLabelDestinationId.Text = ""; //add value when campaigns are added litLabelISCI.Text = Label.ISCICode; litLabelMediaLength.Text = Label.MediaLength; litLabelNumber.Text = Label.LabelNumber.ToString(); litLabelPMTMediaId.Text = Label.PMTMediaId; litLabelStandard.Text = Label.Standard; TapeFormatInfo tf = aCont.Get_TapeFormatById(Label.TapeFormat); litLabelTapeFormat.Text = tf.TapeFormat; printLabel(Label); //if(tf.Label=="A") //{ // pnlLabelA.Visible = true; // pnlLabelB.Visible = false; // lblCustomerA.Text = Label.AdvertiserName; // litBuyerA.Text = Label.AgencyName; // litTitleA.Text = Label.Title; // litTapecodeA.Text = "Tape Code: " + tf.TapeFormat; // litDescA.Text = Label.Description; // litIsciA.Text = "ISCI Code: " + Label.ISCICode; // litMasterIdA.Text = Label.PMTMediaId + " " + DateTime.Now.ToShortDateString() + " " + Label.MediaLength + " " + Label.Standard + " " + Label.LabelNumber.ToString() + " WO# " + Label.CampaignId; // litSpineA.Text = Label.AdvertiserName + "<br /><br />" + Label.Title + "<br /><br />ISCI<br />" + Label.ISCICode + "<br /><br />" + Label.Description + "<br /><br />" + Label.PMTMediaId + "<br />" + Label.MediaLength + " " + Label.Standard; // litBoxFrontA.Text = Label.AdvertiserName + "<br />" + Label.AgencyName + "<br />" + Label.Title + "<br />Tape Code: " + tf.TapeFormat + " " + Label.Description + "<br />ISCI: " + Label.ISCICode + "<br /><br /><br />" + Label.PMTMediaId + " " + DateTime.Now.ToShortDateString() + " " + Label.MediaLength + " " + Label.Standard + "<br />" + Label.LabelNumber.ToString() + " WO# " + Label.CampaignId; //} //else if (tf.Label == "B") //{ // pnlLabelA.Visible = false; // pnlLabelB.Visible = true; // litDVDTLB.Text = Label.PMTMediaId + "<br />" + Label.MediaLength + "<br />" + Label.Standard; // UserInfo csr = UserController.GetUserById(PortalId, Label.CreatedById); // litDVDTRB.Text = Label.LabelNumber.ToString() + "<br />" + csr.DisplayName + "<br />" + Label.DateCreated.ToShortDateString(); // litDVDBottB.Text = Label.AdvertiserName + "<br />" + Label.AgencyName + "<br />" + Label.Title + "<br />" + Label.Description + " " + Label.ISCICode + "<br />"; //} litLabelTitle.Text = Label.Title; pnlLabelView.Visible = true; } else { btnDeleteLabel.Enabled = false; btnSaveLabelAs.Enabled = false; clearLabel(); lblLabelMessage.Text = "There was an error loading this Label."; } //clearAll("Labels"); }
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("&", "&") + "</FullName></CustomerRef>"; xmlString += "<BillAddress><Addr1>" + billto.AdvertiserName.Trim().Replace("&", "&") + "</Addr1><Addr2>" + billto.Address1.Trim().Replace("&", "&"); if (billto.Address2.Trim() != "") { xmlString += " - " + billto.Address2.Trim().Replace("&", "&"); } xmlString += "</Addr2><City>" + billto.City.Trim().Replace("&", "&") + "</City><State>" + billto.State.Trim().Replace("&", "&") + "</State><PostalCode>" + billto.Zip.Trim().Replace("&", "&") + "</PostalCode><Country>" + billto.Country.Trim().Replace("&", "&") + "</Country></BillAddress>"; string po = wo1.PONumber; if (po == "") { try { po = wo1.Groups[0].LibraryItems[0].PMTMediaId.Replace("&", "&"); } catch { } } xmlString += "<PONumber>" + po.Replace("&", "&") + "</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("&", "&") + "</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("&", "&") + "</FullName></ItemRef>"; xmlString += "<Desc>" + lib.Title.Replace("&", "&"); //code.QBCode.Replace("&", "&"); 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("&", "&") + "</FullName></ItemRef>"; xmlString += "<Desc>" + master.Title.Replace("&", "&"); 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("&", "&") + "</Other1>"; xmlString += "<Other2>" + lib.ISCICode.Trim().Replace("&", "&") + "</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("&", "&") + "</FullName></ItemRef>"; } else { xmlString += "<ItemRef><FullName>" + custCodes[custIndex] + "</FullName></ItemRef>"; } xmlString += "<Desc>" + lib.Title.Trim().Replace("&", "&"); 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("&", "&") + "</Other1>"; if (lib.TapeCode.Trim() == "") { xmlString += "<Other2>" + lib.ISCICode.Trim().Replace("&", "&") + "</Other2></InvoiceLineAdd>"; } else { xmlString += "<Other2>" + lib.TapeCode.Trim().Replace("&", "&") + "</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); }