/// <summary> /// Initializes a new instance of the <see cref="ButtonBar"/> class. /// </summary> public ButtonBar() { TabStop = true; Padding = new Padding(3, 3, 3, 3); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.Selectable, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); BackColor = Color.Transparent; items = new GenericCollection<BarItem>(); items.Inserted += OnItemsInserted; items.Removed += OnItemsRemoved; items.Changed += OnItemsChanged; items.Inserting += OnItemsInserting; items.Changing += OnItemsChanging; items.Removing += OnItemsRemoving; items.Clearing += OnItemsClearing; toolTip = new ToolTip(); appearance = new Appearance(); appearance.AppearanceChanged += OnAppearanceChanged; currentAppearance = new Appearance(); themeProperty = new ThemeProperty(); themeProperty.ThemeChanged += OnAppearanceChanged; showScroll = false; useMnemonic = true; showBorders = true; Height = 200; InitializeDefaultScheme(); SetThemeDefaults(); }
public WizardControl() { SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); finishButtonText = "Finish"; nextButtonText = "Next >"; InitializeComponent(); wizardStepCollection = new GenericCollection<WizardStep>(this); wizardStepCollection.Inserted += wizardStepCollection_Inserted; wizardStepCollection.Cleared += wizardStepCollection_Cleared; wizardStepCollection.Removed += wizardStepCollection_Removed; }
private void databind() { try { GenericCollection <PurchaseOrderLineBE> POLineCollection = Session["POLineCollection"] == null ? null : Session["POLineCollection"] as GenericCollection <PurchaseOrderLineBE>; if (POLineCollection != null) { adsource = new PagedDataSource(); adsource.DataSource = POLineCollection; adsource.PageSize = 10; ViewState["PageCount"] = (POLineCollection.Count % 10) == 0 ? (POLineCollection.Count / 10) : (POLineCollection.Count / 10) + 1; adsource.AllowPaging = true; adsource.CurrentPageIndex = pos; btnfirst.Enabled = !adsource.IsFirstPage; btnprevious.Enabled = !adsource.IsFirstPage; btnlast.Enabled = !adsource.IsLastPage; btnnext.Enabled = !adsource.IsLastPage; gvPurchaseOrderLine.DataSource = adsource; gvPurchaseOrderLine.DataBind(); divPaginationPoLine.Visible = true; gvPurchaseOrderLine.Visible = true; } else { gvPurchaseOrderLine.DataSource = null; gvPurchaseOrderLine.DataBind(); divPaginationPoLine.Visible = false; gvPurchaseOrderLine.Visible = false; } } catch (Exception Ex) { lblSearchError.Text = Ex.Message; lblSearchError.Visible = true; logFile.ErrorLogging(Ex); } }
public static GenericCollection GetDict(Type type) { GenericCollection dict; if (Cache.TryGetValue(type, out dict)) { return(dict); } lock (Cache) { if (Cache.TryGetValue(type, out dict)) { return(dict); } dict = new GenericCollection(); dict.Init = Literacy.CreateNewObject(type); if (type.IsGenericType) { var ga = type.GetGenericArguments(); if (ga.Length > 1) { dict.KeyType = type.GetGenericArguments()[0]; dict.ElementType = type.GetGenericArguments()[1]; dict.ElementType = Nullable.GetUnderlyingType(dict.ElementType) ?? dict.ElementType; } else { dict.ElementType = typeof(object); } } else { dict.ElementType = typeof(object); } Cache.Add(type, dict); return(dict); } }
protected void gvTransformations_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "ViewFiles") { ImageButton lb = (ImageButton)e.CommandSource; GridViewRow gvr = (GridViewRow)lb.NamingContainer; GridView gridview = gvr.NamingContainer as GridView; int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = gridview.Rows[index - (gridview.PageIndex * gridview.PageSize)]; Label lblSNo = (Label)selectedRow.FindControl("lblSNo"); GenericCollection <TransformationBE> listOfBE = (GenericCollection <TransformationBE>)Session[v841List]; TransformationBE Headerobj = new TransformationBE(); foreach (TransformationBE obj in listOfBE) { if (obj.SNo.ToString() == lblSNo.Text) { Headerobj = obj; break; } } TransactionBC objBC = new TransactionBC(); TransformationBE objArchiveBE = objBC.Load841Files(Headerobj.ControlNumber, Headerobj.DUNS, Headerobj.TxnDate); Headerobj.ArchiveFile = objArchiveBE.ArchiveFile; Headerobj.AckArchiveFile = objArchiveBE.AckArchiveFile; Session["ArchiveFiles"] = Headerobj; Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "ShowNewPage();", true); } } catch (Exception ex) { } }
public GenericCollection <PurchaseOrderBE> ModifyExtranetPODetails(string POList, string Type) { string BAMEnvironment = HttpContext.Current.Session["Environment"] != null ? HttpContext.Current.Session["Environment"].ToString() : "UAT"; string extranetconnection1 = BAMEnvironment == "UAT" ? ConfigurationSettings.AppSettings["UATExtranetBAMConn"].ToString() : ConfigurationSettings.AppSettings["ProdExtranetBAMConn1"].ToString(); SqlConnection extranetconnection = new SqlConnection(extranetconnection1); GenericCollection <PurchaseOrderBE> PurchaseOrderList = new GenericCollection <PurchaseOrderBE>(); try { SqlParameter[] sqlparams = new SqlParameter[2]; sqlparams[0] = new SqlParameter("@TxnID", POList); sqlparams[1] = new SqlParameter("@type", Type); DataSet ds = null; ds = SqlHelper.ExecuteDataset(extranetconnection, CommandType.StoredProcedure, "usp_get_IndividualPODetails", sqlparams); if (ds != null) { if (ds.Tables.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { PurchaseOrderBE objBE = new PurchaseOrderBE(); objBE.ReferenceID = ds.Tables[0].Rows[i]["TransactionID"].ToString(); objBE.ExtranetStatus = ds.Tables[0].Rows[i]["Status"].ToString(); objBE.POCBODRcvd = ds.Tables[0].Rows[i]["Field5"].ToString(); PurchaseOrderList.Add(i, objBE); } } } } catch (Exception ex) { throw ex; } return(PurchaseOrderList); }
///<summary> ///Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes. ///</summary> /// ///<returns> ///A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"></see> with the properties that are exposed for this data type, or null if there are no properties. ///</returns> /// ///<param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context. </param> ///<param name="attributes">An array of type <see cref="T:System.Attribute"></see> that is used as a filter. </param> ///<param name="value">An <see cref="T:System.Object"></see> that specifies the type of array for which to get properties. </param> public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { GenericCollection <T> collection = value as GenericCollection <T>; if (collection != null) { PropertyDescriptor[] properties = new PropertyDescriptor[collection.Count]; for (int i = 0; i < collection.Count; i++) { try { properties[i] = (new PDesc <T>(collection[i])); } #pragma warning disable EmptyGeneralCatchClause catch (Exception) #pragma warning restore EmptyGeneralCatchClause { } } return(new PropertyDescriptorCollection(properties)); } return(base.GetProperties(context, value, attributes)); }
public void ComplexArrayBehindInterface() { Expression <Func <int, int> > d = i => 1; var source = new GenericCollection <InnerType>() { Collection = new InnerType[2] { new InnerType() { String = "A" }, new InnerType() { String = "B" } } }; var target = new GenericCollection <InnerType>(); var ultraMapper = new Mapper(cfg => { //cfg.MapTypes( source, target ) // .MapMember( s => s.Collection, t => t.Collection, memberMappingConfig: config => // { // Expression<Func<ICollection<InnerType>>> temp = () => new List<InnerType>(); // config.CustomTargetConstructor = temp; // } ); }); ultraMapper.Map(source, target); bool isResultOk = ultraMapper.VerifyMapperResult(source, target); Assert.IsTrue(isResultOk); }
protected void gridPaging(string size) { try { lblSearchError.Text = string.Empty; GenericCollection <DeliveryShipmentBE> listofBE = (GenericCollection <DeliveryShipmentBE>)Session[vDOList]; if (listofBE != null) { if (listofBE.Count == 0) { lblSearchError.Text = "No records found."; lblSearchError.Visible = true; gvDO.DataSource = null; gvDO.DataBind(); lblRec.Visible = false; } else { Utils.GridPaging(gvDO, Convert.ToInt32(size), listofBE); lblRec.Text = Utils.GridRecDispMsg(gvDO.PageIndex, gvDO.PageSize, listofBE.Count); lblRec.Visible = true; } } else { gvDO.DataSource = null; gvDO.DataBind(); lblRec.Visible = false; } } catch (Exception Ex) { lblSearchError.Text = Ex.Message; logFile.ErrorLogging(Ex); } }
public void DataSetCollectionEvaluate_2_1() { // // SetUp the test data for this test case. // DicomMessageCollection dicomMessageCollection1 = new DicomMessageCollection(); DicomMessageCollection dicomMessageCollection2 = new DicomMessageCollection(); DicomMessage dicomMessage1 = new DicomMessage(DimseCommand.CSTORERQ); dicomMessage1.DataSet.Set("0x00200020", VR.UI, "1.1.1.1"); dicomMessageCollection1.Add(dicomMessage1); DicomMessage dicomMessage2 = new DicomMessage(DimseCommand.CSTORERQ); dicomMessage2.DataSet.Set("0x00300030", VR.UI, "1.1.1.1"); dicomMessageCollection2.Add(dicomMessage2); DicomMessage dicomMessage3 = new DicomMessage(DimseCommand.CSTORERQ); dicomMessage3.DataSet.Set("0x00300030", VR.UI, "2.2.2.2"); dicomMessageCollection2.Add(dicomMessage3); DicomMessage dicomMessage4 = new DicomMessage(DimseCommand.CSTORERQ); dicomMessage4.DataSet.Set("0x00300030", VR.UI, "3.3.3.3"); dicomMessageCollection2.Add(dicomMessage4); // // Perform the actual test. // GenericCollection <GenericPair <DataSet, DataSet> > collection = BooleanExpressionTwoDataSets.MapsAttributes("0x00200020", "0x00300030").Evaluate(dicomMessageCollection1.DataSets, dicomMessageCollection2.DataSets); Assert.That(collection.Count, Is.EqualTo(1)); }
private void databindPOHistory() { try { GenericCollection <PurchaseOrderHistoryBE> POHistoryCollection = Session["POHistoryCollection"] == null ? null : Session["POHistoryCollection"] as GenericCollection <PurchaseOrderHistoryBE>; if (POHistoryCollection != null) { adsourceHistory = new PagedDataSource(); adsourceHistory.DataSource = POHistoryCollection; adsourceHistory.PageSize = 5; ViewState["PageCountHistory"] = (POHistoryCollection.Count % 5) == 0 ? (POHistoryCollection.Count / 5) : (POHistoryCollection.Count / 5) + 1; adsourceHistory.AllowPaging = true; adsourceHistory.CurrentPageIndex = posHistory; btnfirstHistory.Enabled = !adsourceHistory.IsFirstPage; btnPreviousHistory.Enabled = !adsourceHistory.IsFirstPage; btnlastHistory.Enabled = !adsourceHistory.IsLastPage; btnNextHistory.Enabled = !adsourceHistory.IsLastPage; gvPOHistory.DataSource = adsourceHistory; gvPOHistory.DataBind(); divPaginationPOHistory.Visible = true; } else { gvPOHistory.DataSource = adsourceHistory; gvPOHistory.DataBind(); divPaginationPOHistory.Visible = false; } } catch (Exception Ex) { lblSearchError.Text = Ex.Message; lblSearchError.Visible = true; logFile.ErrorLogging(Ex); } }
public GenericCollection <ServiceComponent> GetServiceComponentList(string ServiceLineID, string ServiceID, string ServiceOptionID, string ServCompType) { GenericCollection <ServiceComponent> ServiceComponentList = new GenericCollection <ServiceComponent>(); try { SqlParameter[] sqlparams = new SqlParameter[4]; sqlparams[0] = new SqlParameter("@ServiceLineID", ServiceLineID); sqlparams[1] = new SqlParameter("@ServiceID", ServiceID); sqlparams[2] = new SqlParameter("@ServiceOptionID", ServiceOptionID); sqlparams[3] = new SqlParameter("@ServiceComponentType", ServCompType); DataSet ds = null; ds = SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, "Get_ServiceComponentList", sqlparams); if (ds != null) { if (ds.Tables.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { ServiceComponent objBE = new ServiceComponent(); if (ServCompType == "SCH") { objBE.ServiceComponentID = Convert.ToInt32(ds.Tables[0].Rows[i]["ServiceComponentID"].ToString()); } objBE.ServiceComponentDesc = ds.Tables[0].Rows[i]["ServiceComponentDesc"].ToString(); ServiceComponentList.Add(i, objBE); } } } } catch (Exception ex) { throw ex; } return(ServiceComponentList); }
/// <summary> /// An indexer 2 /// </summary> /// <param name="idx"></param> /// <returns></returns> public T this[GenericCollection <T> idx] { get { return(default(T)); } }
private void LoadPODetails(string PoNumber, string POFile, string MessageType) { try { PurchaseOrderBC objBC = new PurchaseOrderBC(); //string ArchiveFile = objBC.GetPOArchiveFile(PONumber); XmlDocument poFile = new XmlDocument(); poFile.Load(POFile); string RootNode = ""; XmlNamespaceManager namespaceManager = new XmlNamespaceManager(poFile.NameTable); if (MessageType.ToLower() == "http://ms.it.ops.cm.processpurchaseorder_v02_10_00#processpurchaseorder_v02_10_00") { namespaceManager.AddNamespace("ns0", "http://MS.IT.Ops.CM.ProcessPurchaseOrder_V02_10_00"); RootNode = "ProcessPurchaseOrder_V02_10_00"; } else { namespaceManager.AddNamespace("ns0", "http://MS.IT.Ops.CM.ChangePurchaseOrder_V01_00_00"); RootNode = "ChangePurchaseOrder_V01_00_00"; } XmlNode xPriceNode = poFile.SelectSingleNode("/ns0:" + RootNode + "/DataArea/PurchaseOrder/Header/ns0:Price/ns0:Amount", namespaceManager); lblPOTotalPrice.Text = xPriceNode == null ? "" : xPriceNode.InnerText; XmlNodeList PartiesNodeList = poFile.SelectNodes("/ns0:" + RootNode + "/DataArea/PurchaseOrder/Header/ns0:Parties", namespaceManager); foreach (XmlNode xnd in PartiesNodeList) { if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "SAPVendor") { XmlNode xSAPVendorNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); lblSAPVendorNumber.Text = xSAPVendorNode == null ? "" : xSAPVendorNode.InnerText; lblSAPVendorNumber.Text = objBC.GetPartnerName(lblSAPVendorNumber.Text); } if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Contract Manufacturer") { XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); lblCM.Text = xCMNode == null ? "" : xCMNode.InnerText; lblCM.Text = objBC.GetPartnerName(lblCM.Text); } if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "ShipTo") { XmlNode xNameNode = xnd.SelectSingleNode("ns0:ContactInformation/ns0:Name", namespaceManager); lblShipToName.Text = xNameNode == null ? "" : xNameNode.InnerText; XmlNode xPhoneNode = xnd.SelectSingleNode("ns0:ContactInformation/ns0:Phone", namespaceManager); lblShipToPhone.Text = xPhoneNode == null ? "" : xPhoneNode.InnerText; XmlNode xPartnerNameNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); lblShipToPartnername.Text = xPartnerNameNode == null ? "" : xPartnerNameNode.InnerText; lblShipToPartnername.Text = objBC.GetPartnerName(lblShipToPartnername.Text); XmlNode xAddressLine1Node = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:AddressLine1", namespaceManager); lblShipToAddressLine1.Text = xAddressLine1Node == null ? "" : xAddressLine1Node.InnerText; XmlNode xCityNode = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:City", namespaceManager); lblShipToCity.Text = xCityNode == null ? "" : xCityNode.InnerText; XmlNode xCountryNode = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:Country", namespaceManager); lblShipToCountry.Text = xCountryNode == null ? "" : xCountryNode.InnerText; XmlNode xZipNode = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:Zip", namespaceManager); lblShipToZIP.Text = xZipNode == null ? "" : xZipNode.InnerText; XmlNode xStateNode = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:State", namespaceManager); lblShipToState.Text = xStateNode == null ? "" : xStateNode.InnerText; } } XmlNode xPOTypeNode = poFile.SelectSingleNode("/ns0:" + RootNode + "/DataArea/PurchaseOrder/Header/Application/SAP/ns0:PurchaseOrderType", namespaceManager); lblSAPPOType.Text = xPOTypeNode == null ? "" : xPOTypeNode.InnerText; BindPOLines(poFile, namespaceManager, RootNode); GenericCollection <PurchaseOrderHistoryBE> POHistryList = new GenericCollection <PurchaseOrderHistoryBE>(); POHistryList = objBC.BindPOHistory(PoNumber); Session["POHistoryCollection"] = POHistryList; databind(); this.ViewState["vs"] = 0; databindPOHistory(); this.ViewState["vsHistory"] = 0; trPODetails.Visible = true; } catch (Exception Ex) { lblSearchError.Text = Ex.Message; lblSearchError.Visible = true; logFile.ErrorLogging(Ex); trPODetails.Visible = false; } }
private void BindPurchaseOrder() { PurchaseOrderBC objBC = new PurchaseOrderBC(); try { trPODetails.Visible = false; DateTime?DateFrom = txtDateFrom.Text == "" ? Convert.ToDateTime("1/1/1990") : Convert.ToDateTime(txtDateFrom.Text); DateTime?DateTo = txtDateFrom.Text == "" ? Convert.ToDateTime("12/31/2050") : Convert.ToDateTime(txtDateTo.Text); trPODetails.Visible = false; GenericCollection <PurchaseOrderBE> listOfBE = objBC.GetIndividualPODetails(txtPONumber.Text, drdTxnType.SelectedValue, DateFrom, DateTo, drdServiceComponentPartnerSearch.SelectedValue); GenericCollection <PurchaseOrderBE> FinalList = new GenericCollection <PurchaseOrderBE>(); string ExtranetPartners = ConfigurationSettings.AppSettings["ExtranetCMS"]; foreach (PurchaseOrderBE objBE in listOfBE) { if (ExtranetPartners.Contains(objBE.CM)) { objBE.isICOEPartner = "NO"; } else { objBE.isICOEPartner = "YES"; } } if (drdISOEorExtranet.SelectedIndex == 1) { int i = 0; foreach (PurchaseOrderBE obj1 in listOfBE) { if (obj1.isICOEPartner == "YES") { FinalList.Add(i, obj1); } } listOfBE = FinalList; } if (drdISOEorExtranet.SelectedIndex == 2) { int i = 0; foreach (PurchaseOrderBE obj1 in listOfBE) { if (obj1.isICOEPartner == "NO") { FinalList.Add(i, obj1); } } listOfBE = FinalList; } if (drdISOEorExtranet.SelectedIndex != 1) { listOfBE = ModifyExtranetPODetails(listOfBE); } if (drdPOStatus.SelectedIndex == 1) { int j = 0; for (int i = 0; i < listOfBE.Count; i++) { if (listOfBE[i].isICOEPartner == "NO" && listOfBE[i].ExtranetStatus.ToLower() == "success") { FinalList.Add(j, listOfBE[i]); j++; } if (listOfBE[i].isICOEPartner == "YES" && listOfBE[i].CorpnetStatus.ToLower() == "success") { FinalList.Add(j, listOfBE[i]); j++; } } listOfBE = FinalList; } if (drdPOStatus.SelectedIndex == 2) { int j = 0; for (int i = 0; i < listOfBE.Count; i++) { if (listOfBE[i].isICOEPartner == "NO" && listOfBE[i].ExtranetStatus.ToLower() == "failed") { FinalList.Add(j, listOfBE[i]); j++; } if (listOfBE[i].isICOEPartner == "YES" && listOfBE[i].CorpnetStatus.ToLower() == "failed") { FinalList.Add(j, listOfBE[i]); j++; } } listOfBE = FinalList; } if (drdPOStatus.SelectedIndex == 3) { for (int i = 0; i < listOfBE.Count; i++) { if (listOfBE[i].isICOEPartner == "NO" && (listOfBE[i].ExtranetStatus.ToLower() == "failed" || listOfBE[i].ExtranetStatus.ToLower() == "na")) { FinalList.Add(i, listOfBE[i]); } } listOfBE = FinalList; } //listOfBE = GetASNStatus(listOfBE); if (ViewState[grdPageSize] != null) { gvPurchaseOrder.PageSize = Convert.ToInt32(ViewState[grdPageSize].ToString()); } else { gvPurchaseOrder.PageSize = 10; } lblRec.Text = Utils.GridRecDispMsg(gvPurchaseOrder.PageIndex, gvPurchaseOrder.PageSize, listOfBE.Count); gvPurchaseOrder.Visible = true; if (listOfBE != null && listOfBE.Count > 0) { rowPage.Visible = true; rowGrid.Visible = true; gvPurchaseOrder.DataSource = listOfBE; gvPurchaseOrder.DataBind(); lblRec.Text = Utils.GridRecDispMsg(gvPurchaseOrder.PageIndex, gvPurchaseOrder.PageSize, listOfBE.Count); gvPurchaseOrder.Visible = true; lblRec.Visible = true; } else { lblRec.Visible = false; rowGrid.Visible = false; rowPage.Visible = false; gvPurchaseOrder.Visible = false; gvPurchaseOrder.DataSource = null; gvPurchaseOrder.DataBind(); lblSearchError.Text = "No records found."; lblSearchError.Visible = true; } Session[vPOList] = listOfBE; } catch (Exception ex) { lblSearchError.Text = ex.Message; lblSearchError.Visible = true; logFile.ErrorLogging(ex); } }
static void Main(string[] args) { // make some members var rootMember = new Member() { Name = "Johny" }; var member1 = new Member() { Name = "Andy" }; var member2 = new Member() { Name = "Adam" }; var member3 = new Member() { Name = "Andrew" }; var member4 = new Member() { Name = "Davis" }; var member5 = new Member() { Name = "Simon" }; // construct some arbitrary references between them member1.Reference = member4; member3.Reference = member1; member5.Reference = member2; // add all of the to the family tree rootMember.FamilyTree.Add(member1); rootMember.FamilyTree.Add(member2); rootMember.FamilyTree.Add(member3); member2.FamilyTree.Add(member4); member4.FamilyTree.Add(member5); var familyTree = new GenericCollection() { rootMember }; IFamilyTreeFile file = new FamilyTreeFile() { FamilyTree = familyTree }; Console.WriteLine("--- input ---"); Serialize(file); PrintTree(file.FamilyTree, 0); Console.WriteLine(); Console.WriteLine("--- output ---"); file = Deserialize(); file.FamilyTree.RebuildReferences(file.FamilyTree); // this is where the refereces // are put together again after deserializing the object tree. PrintTree(file.FamilyTree, 0); Console.ReadLine(); }
public Member() { ID = Guid.NewGuid(); FamilyTree = new GenericCollection(); }
public int CountGreaterThan(GenericCollection <Box <T> > elements) { return(elements.Count(e => e.Value.CompareTo(this.Value) > 0)); }
/// <summary> /// sorts the grid based on sort expression and sort direction /// </summary> /// <typeparam name="T"> Type</typeparam> /// <param name="gvObject">Gridview</param> /// <param name="sDir">sortDirection</param> /// <param name="sortExpr">sortExpression</param> /// <param name="collection">List of Items with genericcollection</param> public static GenericCollection <T> GridSorting <T>(GridView gvObject, SortDirection sDir, string sortExpr, GenericCollection <T> collection) { GenericCollection <T> .GenericComparer comparer = new GenericCollection <T> .GenericComparer(sortExpr, sDir); collection.Sort(comparer); gvObject.DataSource = collection; gvObject.DataBind(); return(collection); }
private void BindPurchaseOrder() { TransactionBC objBC = new TransactionBC(); try { DateTime?DateFrom = txtDateFrom.Text == "" ? Convert.ToDateTime("1/1/1990") : Convert.ToDateTime(txtDateFrom.Text); DateTime?DateTo = txtDateTo.Text == "" ? Convert.ToDateTime("12/31/2050") : Convert.ToDateTime(txtDateTo.Text); GenericCollection <TransformationBE> listOfBE = objBC.GetTransformationDetails(DateFrom, DateTo, txtControlNumber.Text.Trim(), drdServiceComponentPartnerSearch.SelectedValue, txtPONumber.Text.Trim(), txtPlant.Text.Trim()); GenericCollection <TransformationBE> DisplayList = new GenericCollection <TransformationBE>(); foreach (TransformationBE objExt1 in listOfBE) { if ((objExt1.StageName.ToLower().Contains("error") || objExt1.StageName.ToLower().Contains("failed")) && (objExt1.StageName != "LogError_NegativeMDNReceived" || objExt1.StageName != "LogError_MDN_NotReceived")) { objExt1.Status = "Failed"; } else { objExt1.Status = "Success"; } if (objExt1.StageName == "SentPositive997ToPartner") { objExt1.FuncAck = "pos997"; } if (objExt1.StageName == "SentNegative997ToPartner") { objExt1.FuncAck = "neg997"; } if (objExt1.StageName == "SentPositiveEDI824ToPartner") { objExt1.FuncAck = "pos824"; } if (objExt1.StageName == "SentNegativeEDI824ToPartner") { objExt1.FuncAck = "Neg824"; } if (objExt1.StageName == "LogError_MDN_NotReceived") { objExt1.MDN = "NoMDN"; } if (objExt1.StageName == "PositiveMDNReceived") { objExt1.MDN = "posMDN"; } if (objExt1.StageName == "LogError_NegativeMDNReceived") { objExt1.MDN = "NegMDN"; } if (objExt1.StageName == "SendPositiveEDI824for841ToBatchPrimaryTransport") { objExt1.FuncAck = "Pos824Batch"; } if (objExt1.StageName == "SendNegativeEDI824for841ToBatchPrimaryTransport") { objExt1.FuncAck = "Neg824Batch"; } } for (int j = 0; j < listOfBE.Count; j++) { if (DisplayList.Count == 0) { DisplayList.Add(j, listOfBE[j]); } else { bool duplicate = false; for (int k = 0; k < DisplayList.Count; k++) { if (listOfBE[j].ControlNumber == DisplayList[k].ControlNumber && listOfBE[j].CM == DisplayList[k].CM && listOfBE[j].TxnDate == DisplayList[k].TxnDate) { DisplayList[k].Status = String.IsNullOrEmpty(DisplayList[k].Status) ? listOfBE[j].Status : DisplayList[k].Status; DisplayList[k].FuncAck = String.IsNullOrEmpty(DisplayList[k].FuncAck) ? listOfBE[j].FuncAck : DisplayList[k].FuncAck; DisplayList[k].MDN = String.IsNullOrEmpty(DisplayList[k].MDN) ? listOfBE[j].MDN : DisplayList[k].MDN; duplicate = true; } } if (!duplicate) { DisplayList.Add(DisplayList.Count, listOfBE[j]); } } } if (DisplayList.Count > 0) { listOfBE = DisplayList; } Session[v841List] = listOfBE; if (ViewState[grdPageSize] != null) { gvTransformations.PageSize = Convert.ToInt32(ViewState[grdPageSize].ToString()); } else { gvTransformations.PageSize = 10; } lblRec.Text = Utils.GridRecDispMsg(gvTransformations.PageIndex, gvTransformations.PageSize, listOfBE.Count); gvTransformations.Visible = true; if (listOfBE != null && listOfBE.Count > 0) { rowPage.Visible = true; rowGrid.Visible = true; gvTransformations.DataSource = listOfBE; gvTransformations.DataBind(); lblRec.Text = Utils.GridRecDispMsg(gvTransformations.PageIndex, gvTransformations.PageSize, listOfBE.Count); gvTransformations.Visible = true; lblRec.Visible = true; } else { lblRec.Visible = false; rowGrid.Visible = false; rowPage.Visible = false; gvTransformations.Visible = false; gvTransformations.DataSource = null; gvTransformations.DataBind(); lblSearchError.Text = "No records found."; lblSearchError.Visible = true; } } catch (Exception ex) { lblSearchError.Text = ex.Message; lblSearchError.Visible = true; logFile.ErrorLogging(ex); } }
public static GenericCollection GetList(Type type) { GenericCollection list; if (_Cache.TryGetValue(type, out list)) { return list; } if (type.GetInterface("System.Collections.IList") != typeof(IList)) { return null; } lock (_Cache) { if (_Cache.TryGetValue(type, out list)) { return list; } list = new GenericCollection(); list.Init = Literacy.CreateNewObject(type); if (type.IsGenericType) { list.ElementType = type.GetGenericArguments()[0]; list.ElementType = Nullable.GetUnderlyingType(list.ElementType) ?? list.ElementType; } else { list.ElementType = typeof(object); } _Cache.Add(type, list); return list; } }
public static GenericCollection GetDict(Type type) { GenericCollection dict; if (_Cache.TryGetValue(type, out dict)) { return dict; } lock (_Cache) { if (_Cache.TryGetValue(type, out dict)) { return dict; } dict = new GenericCollection(); dict.Init = Literacy.CreateNewObject(type); if (type.IsGenericType) { var ga = type.GetGenericArguments(); if (ga.Length > 1) { dict.KeyType = type.GetGenericArguments()[0]; dict.ElementType = type.GetGenericArguments()[1]; dict.ElementType = Nullable.GetUnderlyingType(dict.ElementType) ?? dict.ElementType; } else { dict.ElementType = typeof(object); } } else { dict.ElementType = typeof(object); } _Cache.Add(type, dict); return dict; } }
/// <summary> /// 序列化 /// </summary> /// <returns>The encode.</returns> /// <param name="val">要序列化的对象</param> public static GenericCollectionValue Serialize(object val) { GenericCollectionValue genericVal = null; if (val is null) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Null }; } else if (val is byte[]) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Bytes, BytesValue = ByteString.CopyFrom((byte[])val) }; } else if (val is byte) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Byte, IntValue = (byte)val }; } else if (val is short) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Short, IntValue = (short)val }; } else if (val is int) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Int, IntValue = (int)val }; } else if (val is long) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Long, LongIntValue = (long)val }; } else if (val is bool) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Bool, BoolValue = (bool)val }; } else if (val is float) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Float, FloatValue = (float)val }; } else if (val is double) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Double, DoubleValue = (double)val }; } else if (val is string) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.String, StringValue = (string)val }; } else if (val is PlayObject playObject) { var bytes = SerializePlayObject(playObject); genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Map, BytesValue = ByteString.CopyFrom(bytes) }; } else if (val is PlayArray playArray) { var collection = new GenericCollection(); foreach (object obj in playArray) { collection.ListValue.Add(Serialize(obj)); } genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Array, BytesValue = collection.ToByteString() }; } else { var type = val.GetType(); if (typeDict.TryGetValue(type, out var customType)) { genericVal = new GenericCollectionValue { Type = GenericCollectionValue.Types.Type.Object, ObjectTypeId = customType.TypeId, BytesValue = ByteString.CopyFrom(customType.SerializeMethod(val)) }; } else { throw new Exception($"{type} is not supported"); } } return(genericVal); }
/// <summary> /// 以指定的 <see cref="GenericCollection{T}"/> /// 初始化 <see cref="DebugView"/> 类的新实例。 /// </summary> /// <param name="collection"> /// 要获取调试器视图的 <see cref="GenericCollection{T}"/>。</param> internal DebugView(GenericCollection <T> collection) { this.Collection = collection.Collection; }
private void BindDeliveryOrder() { TransactionBC objBC = new TransactionBC(); PurchaseOrderBC objPucBC = new PurchaseOrderBC(); try { DateTime?DateFrom = txtDateFrom.Text == "" ? Convert.ToDateTime("1/1/1990") : Convert.ToDateTime(txtDateFrom.Text); DateTime?DateTo = txtDateTo.Text == "" ? Convert.ToDateTime("12/31/2050") : Convert.ToDateTime(txtDateTo.Text); GenericCollection <DeliveryShipmentBE> listOfBE = objBC.GetDeliveryShipmentDetails("Get", TxtIDOC.Text.Trim(), txtDO.Text.Trim(), txtPO.Text.Trim(), drdStatus.SelectedValue, drdServiceComponentPartnerSearch.SelectedValue, txtPlant.Text.Trim(), txtOrderType.Text.Trim(), DateFrom, DateTo); foreach (DeliveryShipmentBE obj in listOfBE) { string PartnerName = objPucBC.GetPartnerName(obj.Plant); obj.CM = PartnerName == "" ? obj.CM : PartnerName; } Session[vDOList] = listOfBE; if (ViewState[grdPageSize] != null) { gvDO.PageSize = Convert.ToInt32(ViewState[grdPageSize].ToString()); } else { gvDO.PageSize = 10; } lblRec.Text = Utils.GridRecDispMsg(gvDO.PageIndex, gvDO.PageSize, listOfBE.Count); gvDO.Visible = true; if (listOfBE != null && listOfBE.Count > 0) { rowPage.Visible = true; rowGrid.Visible = true; gvDO.DataSource = listOfBE; gvDO.DataBind(); lblRec.Text = Utils.GridRecDispMsg(gvDO.PageIndex, gvDO.PageSize, listOfBE.Count); gvDO.Visible = true; lblRec.Visible = true; } else { lblRec.Visible = false; rowGrid.Visible = false; rowPage.Visible = false; gvDO.Visible = false; gvDO.DataSource = null; gvDO.DataBind(); lblSearchError.Text = "No records found."; lblSearchError.Visible = true; } } catch (Exception ex) { lblSearchError.Text = ex.Message; lblSearchError.Visible = true; logFile.ErrorLogging(ex); } }
public static TItem LongestToString <TItem>(this GenericCollection <TItem> collection) { return(collection.Aggregate((i1, i2) => i1.ToString().Length > i2.ToString().Length ? i1 : i2)); }
public static void GridPaging <T>(GridView gvObject, Int32 PageSize, GenericCollection <T> listObj) { gvObject.PageSize = PageSize; gvObject.DataSource = listObj; gvObject.DataBind(); }
public static HashSet <TItem> ToHashSet <TItem>(this GenericCollection <TItem> source) { return(new HashSet <TItem>(source)); }
private GenericCollection <ASNHeaderBE> PrepareASNList(GenericCollection <ASNHeaderBE> listOfBE) { TransactionBC objTranBC = new TransactionBC(); PurchaseOrderBC objBC = new PurchaseOrderBC(); GenericCollection <ASNHeaderBE> ASNList = new GenericCollection <ASNHeaderBE>(); for (int i = 0; i < listOfBE.Count; i++) { ASNHeaderBE objBE = new ASNHeaderBE(); objBE.SNo = i; objBE.TxnType = "3B2"; objBE.TxnDate = listOfBE[i].TxnDate; //string File = listOfBE[0].ArchiveFile; XmlDocument ASNFile = new XmlDocument(); //ASNFile.Load(@"D:\BPM\SampleFiles\ASNEGLFiles.xml"); ASNFile.Load(listOfBE[i].ArchiveFile); objBE.ArchiveFile = listOfBE[i].ArchiveFile; XmlNamespaceManager namespaceManager = new XmlNamespaceManager(ASNFile.NameTable); namespaceManager.AddNamespace("ns0", "http://MS.IT.Ops.HED.ShowShipment_V02_00_00"); XmlNode xPartnerNode = ASNFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/ApplicationArea/Sender/ns0:LogicalId", namespaceManager); objBE.CM = xPartnerNode == null ? "" : objBC.GetPartnerName(xPartnerNode.InnerText); objBE.CM = objBE.CM == "" ? xPartnerNode.InnerText : objBE.CM; XmlNode xASTransactionID = ASNFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/ApplicationArea/ns0:ReferenceId", namespaceManager); objBE.ASFeedTxnID = xASTransactionID == null ? "" : xASTransactionID.InnerText; XmlNode xReceiverKey = ASNFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/routing/ReceiverKey", namespaceManager); objBE.ReceiverKey = xReceiverKey == null ? "" : xReceiverKey.InnerText; XmlNode xShipDate = ASNFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/DataArea/Shipment/Header/TransportationEvent/ns0:DateTime", namespaceManager); if (xShipDate != null) { try { objBE.ShipDate = Convert.ToDateTime(xShipDate.InnerText.Substring(0, 4) + "-" + xShipDate.InnerText.Substring(4, 2) + "-" + xShipDate.InnerText.Substring(6, 2)); } catch (Exception ex) { } } XmlNodeList PartiesNodeList = ASNFile.SelectNodes("ns0:ShowShipment_V02_00_00/DataArea/Shipment/Header/Parties", namespaceManager); XmlNodeList TrackingReferenceNodes = ASNFile.SelectNodes("ns0:ShowShipment_V02_00_00/DataArea/Shipment/Header/TrackingReference", namespaceManager); XmlNodeList LineItemNodes = ASNFile.SelectNodes("ns0:ShowShipment_V02_00_00/DataArea/Shipment/LineItem", namespaceManager); if (LineItemNodes != null) { objBE.LineCount = LineItemNodes.Count; } foreach (XmlNode xnd in PartiesNodeList) { if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Originating Party") { XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); objBE.OriginationParty = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText); objBE.OriginationParty = objBE.OriginationParty == "" ? xCMNode.InnerText : objBE.OriginationParty; } if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Selling Partner") { XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); objBE.SellingPartner = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText); objBE.SellingPartner = objBE.SellingPartner == "" ? xCMNode.InnerText : objBE.SellingPartner; } if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Ship To") { XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); objBE.SAPShipTo = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText); objBE.SAPShipTo = objBE.SAPShipTo == "" ? xCMNode.InnerText : objBE.SAPShipTo; } if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Freight Forwarder") { XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); objBE.FMV = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText); objBE.FMV = objBE.FMV == "" ? xCMNode.InnerText : objBE.FMV; } } foreach (XmlNode xnd in TrackingReferenceNodes) { if (xnd.SelectSingleNode("ns0:TrackingCode", namespaceManager).InnerText == "Load Identifier") { XmlNode xCMNode = xnd.SelectSingleNode("ns0:TrackingId", namespaceManager); objBE.LoadID = xCMNode == null ? "" : xCMNode.InnerText.Substring(0, xCMNode.InnerText.Length - 2); } } GenericCollection <ASNLinesBE> objLinesList = new GenericCollection <ASNLinesBE>(); int j = 0; foreach (XmlNode xnd in LineItemNodes) { ASNLinesBE objLineBE = new ASNLinesBE(); XmlNodeList LineDocRefNodes = ASNFile.SelectNodes("/ns0:ShowShipment_V02_00_00/DataArea/Shipment/LineItem/DocumentReference", namespaceManager); foreach (XmlNode xndDoc in LineDocRefNodes) { if (xndDoc.SelectSingleNode("ns0:DocumentTypeCode", namespaceManager).InnerText == "Packing Slip Number") { XmlNode xCMNode = xndDoc.SelectSingleNode("ns0:Id", namespaceManager); objLineBE.PackSlipNumber = xPartnerNode == null ? "" : xCMNode.InnerText; } if (xndDoc.SelectSingleNode("ns0:DocumentTypeCode", namespaceManager).InnerText == "Purchase Order") { XmlNode xCMNode = xndDoc.SelectSingleNode("ns0:Id", namespaceManager); objLineBE.PONumber = xPartnerNode == null ? "" : xCMNode.InnerText; XmlNode xLineNumber = xndDoc.SelectSingleNode("ns0:LineNumber", namespaceManager); objLineBE.LineNumber = xLineNumber == null ? "" : xLineNumber.InnerText; } } XmlNode xSKUNode = xnd.SelectSingleNode("OrderItem/ns0:ProductIdentifier", namespaceManager); objLineBE.SKU = xSKUNode == null ? "" : xSKUNode.InnerText; XmlNode xUnitsShippedNode = xnd.SelectSingleNode("ns0:UnitsShipped", namespaceManager); objLineBE.ItemQuantity = xUnitsShippedNode == null ? "" : xUnitsShippedNode.InnerText; objLinesList.Add(j, objLineBE); j++; } objBE.ASNLines = objLinesList; if (objBE.LineCount == 1 && objLinesList != null) { objBE.PONumber = objLinesList[0].PONumber; } else { objBE.PONumber = "See Details"; } ASNList.Add(i, objBE); } return(ASNList); }
//private GenericCollection<ShowShipHeaderBE> PrepareShowShipDetails(GenericCollection<ShowShipHeaderBE> listOfBE) //{ // TransactionBC objTranBC = new TransactionBC(); // PurchaseOrderBC objBC = new PurchaseOrderBC(); // GenericCollection<ShowShipHeaderBE> ShowShipList = new GenericCollection<ShowShipHeaderBE>(); // for (int i = 0; i < listOfBE.Count; i++) // { // ShowShipHeaderBE objBE = new ShowShipHeaderBE(); // objBE.SNo = i; // objBE.TxnType = "3B2"; // objBE.TxnDate = listOfBE[i].TxnDate; // //string File = listOfBE[0].ArchiveFile; // XmlDocument ShowShipFile = new XmlDocument(); // //ShowShipFile.Load(@"D:\BPM\SampleFiles\ShowShipEGLFiles.xml"); // ShowShipFile.Load(listOfBE[i].ArchiveFile); // objBE.ArchiveFile = listOfBE[i].ArchiveFile; // XmlNamespaceManager namespaceManager = new XmlNamespaceManager(ShowShipFile.NameTable); // namespaceManager.AddNamespace("ns0", "http://MS.IT.Ops.HED.ShowShipment_V02_00_00"); // XmlNode xPartnerNode = ShowShipFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/ApplicationArea/Sender/ns0:LogicalId", namespaceManager); // objBE.CM = xPartnerNode == null ? "" : objBC.GetPartnerName(xPartnerNode.InnerText); // objBE.CM = objBE.CM == "" ? xPartnerNode.InnerText : objBE.CM; // XmlNode xASTransactionID = ShowShipFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/ApplicationArea/ns0:ReferenceId", namespaceManager); // objBE.ASFeedTxnID = xASTransactionID == null ? "" : xASTransactionID.InnerText; // XmlNode xReceiverKey = ShowShipFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/routing/ReceiverKey", namespaceManager); // objBE.ReceiverKey = xReceiverKey == null ? "" : xReceiverKey.InnerText; // XmlNode xShipDate = ShowShipFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/DataArea/Shipment/Header/TransportationEvent/ns0:DateTime", namespaceManager); // if (xShipDate != null) // { // try // { // objBE.ShipDate = Convert.ToDateTime(xShipDate.InnerText.Substring(0, 4) + "-" + xShipDate.InnerText.Substring(4, 2) + "-" + xShipDate.InnerText.Substring(6, 2)); // } // catch (Exception ex) // { // } // } // XmlNodeList PartiesNodeList = ShowShipFile.SelectNodes("ns0:ShowShipment_V02_00_00/DataArea/Shipment/Header/Parties", namespaceManager); // XmlNodeList TrackingReferenceNodes = ShowShipFile.SelectNodes("ns0:ShowShipment_V02_00_00/DataArea/Shipment/Header/TrackingReference", namespaceManager); // XmlNodeList LineItemNodes = ShowShipFile.SelectNodes("ns0:ShowShipment_V02_00_00/DataArea/Shipment/LineItem", namespaceManager); // if (LineItemNodes != null) // objBE.LineCount = LineItemNodes.Count; // foreach (XmlNode xnd in PartiesNodeList) // { // if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Originating Party") // { // XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); // objBE.OriginationParty = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText); // objBE.OriginationParty = objBE.OriginationParty == "" ? xCMNode.InnerText : objBE.OriginationParty; // } // if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Selling Partner") // { // XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); // objBE.SellingPartner = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText); // objBE.SellingPartner = objBE.SellingPartner == "" ? xCMNode.InnerText : objBE.SellingPartner; // } // if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Ship To") // { // XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); // objBE.SAPShipTo = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText); // objBE.SAPShipTo = objBE.SAPShipTo == "" ? xCMNode.InnerText : objBE.SAPShipTo; // } // if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Freight Forwarder") // { // XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager); // objBE.FMV = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText); // objBE.FMV = objBE.FMV == "" ? xCMNode.InnerText : objBE.FMV; // } // } // foreach (XmlNode xnd in TrackingReferenceNodes) // { // if (xnd.SelectSingleNode("ns0:TrackingCode", namespaceManager).InnerText == "Load Identifier") // { // XmlNode xCMNode = xnd.SelectSingleNode("ns0:TrackingId", namespaceManager); // objBE.LoadID = xCMNode == null ? "" : xCMNode.InnerText.Substring(0, xCMNode.InnerText.Length - 2); // } // } // GenericCollection<ShowShipLinesBE> objLinesList = new GenericCollection<ShowShipLinesBE>(); // int j = 0; // foreach (XmlNode xnd in LineItemNodes) // { // ShowShipLinesBE objLineBE = new ShowShipLinesBE(); // XmlNodeList LineDocRefNodes = ShowShipFile.SelectNodes("/ns0:ShowShipment_V02_00_00/DataArea/Shipment/LineItem/DocumentReference", namespaceManager); // foreach (XmlNode xndDoc in LineDocRefNodes) // { // if (xndDoc.SelectSingleNode("ns0:DocumentTypeCode", namespaceManager).InnerText == "Packing Slip Number") // { // XmlNode xCMNode = xndDoc.SelectSingleNode("ns0:Id", namespaceManager); // objLineBE.PackSlipNumber = xPartnerNode == null ? "" : xCMNode.InnerText; // } // if (xndDoc.SelectSingleNode("ns0:DocumentTypeCode", namespaceManager).InnerText == "Purchase Order") // { // XmlNode xCMNode = xndDoc.SelectSingleNode("ns0:Id", namespaceManager); // objLineBE.PONumber = xPartnerNode == null ? "" : xCMNode.InnerText; // XmlNode xLineNumber = xndDoc.SelectSingleNode("ns0:LineNumber", namespaceManager); // objLineBE.LineNumber = xLineNumber == null ? "" : xLineNumber.InnerText; // } // } // XmlNode xSKUNode = xnd.SelectSingleNode("OrderItem/ns0:ProductIdentifier", namespaceManager); // objLineBE.SKU = xSKUNode == null ? "" : xSKUNode.InnerText; // XmlNode xUnitsShippedNode = xnd.SelectSingleNode("ns0:UnitsShipped", namespaceManager); // objLineBE.ItemQuantity = xUnitsShippedNode == null ? "" : xUnitsShippedNode.InnerText; // objLinesList.Add(j, objLineBE); // j++; // } // objBE.ShowShipLines = objLinesList; // if (objBE.LineCount == 1 && objLinesList != null) // objBE.PONumber = objLinesList[0].PONumber; // else // objBE.PONumber = "See Details"; // ShowShipList.Add(i, objBE); // } // return ShowShipList; //} protected void gvDO_RowCommand(object sender, GridViewCommandEventArgs e) { try { //if (e.CommandName == "ViewDetails") //{ // ImageButton lb = (ImageButton)e.CommandSource; // GridViewRow gvr = (GridViewRow)lb.NamingContainer; // GridView gridview = gvr.NamingContainer as GridView; // int index = Convert.ToInt32(e.CommandArgument); // GridViewRow selectedRow = gridview.Rows[index - (gridview.PageIndex * gridview.PageSize)]; // Label lblSNo = (Label)selectedRow.FindControl("lblSNo"); // GenericCollection<ShowShipHeaderBE> listOfBE = (GenericCollection<ShowShipHeaderBE>)Session[vDOList]; // GenericCollection<ShowShipLinesBE> lines = new GenericCollection<ShowShipLinesBE>(); // ShowShipHeaderBE Headerobj = new ShowShipHeaderBE(); // foreach (ShowShipHeaderBE obj in listOfBE) // { // if (obj.SNo.ToString() == lblSNo.Text) // { // Headerobj = obj; // break; // } // } // lines = Headerobj.ShowShipLines; // trPODetails.Visible = false; // Session["ShowShipLineCollection"] = lines; // databind(); //} if (e.CommandName == "ViewFiles") { ImageButton lb = (ImageButton)e.CommandSource; GridViewRow gvr = (GridViewRow)lb.NamingContainer; GridView gridview = gvr.NamingContainer as GridView; int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = gridview.Rows[index - (gridview.PageIndex * gridview.PageSize)]; Label lblSNo = (Label)selectedRow.FindControl("lblSNo"); Label lblTransactionID = (Label)selectedRow.FindControl("lblTransactionID"); Label lblDONumber = (Label)selectedRow.FindControl("lblDONumber"); GenericCollection <DeliveryShipmentBE> listOfBE = (GenericCollection <DeliveryShipmentBE>)Session[vDOList]; DeliveryShipmentBE Headerobj = new DeliveryShipmentBE(); foreach (DeliveryShipmentBE obj in listOfBE) { if (obj.SNo.ToString() == lblSNo.Text) { Headerobj = obj; break; } } TransactionBC objBC = new TransactionBC(); GenericCollection <DeliveryShipmentBE> ArchiveObjects = new GenericCollection <DeliveryShipmentBE>(); ArchiveObjects = objBC.GetDeliveryShipmentDetails("Files", lblTransactionID.Text, lblDONumber.Text, "", "", "", "", "", null, null); Headerobj.DOIDOCArchiveFile = ArchiveObjects[0].DOIDOCArchiveFile; Headerobj.ProcessShipmentArchiveFile = ArchiveObjects[0].ProcessShipmentArchiveFile; Session["ArchiveFiles"] = Headerobj; Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "ShowNewPage();", true); } if (e.CommandName == "ViewError") { ImageButton lb = (ImageButton)e.CommandSource; GridViewRow gvr = (GridViewRow)lb.NamingContainer; GridView gridview = gvr.NamingContainer as GridView; int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = gridview.Rows[index - (gridview.PageIndex * gridview.PageSize)]; Label lblTransactioID = (Label)selectedRow.FindControl("lblTransactionID"); Label lblDONumber = (Label)selectedRow.FindControl("lblDONumber"); PurchaseOrderBC objBC = new PurchaseOrderBC(); string Error = objBC.LoadPOErrorMessage(lblDONumber.Text, lb.ID == "imgStatus" ? "Extranet" : "Corpnet"); string PoNumber = " Transaction ID : " + lblTransactioID.Text + " \\n Delivery Order : " + lblDONumber.Text + " \\n Error Details : \\n "; string errormessage = "Error Number : " + Error.Split(',')[0] + " \\n Error Description : \\n " + Error.Split(',')[1]; //Label LabelTxnType = (Label)selectedRow.FindControl("LabelTxnType"); string Eror = "My Error"; //ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "ShowMessage();", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Registering", "$(document).ready(function(){ ShowMessage('" + lblTransactioID.Text + "','" + lblDONumber.Text + "','" + Error.Split(',')[0] + "','" + Error.Split(',')[1] + "'); });", true); } } catch (Exception ex) { } }
private void BindPurchaseOrder() { TransactionBC objBC = new TransactionBC(); try { trPODetails.Visible = false; DateTime?DateFrom = txtDateFrom.Text == "" ? Convert.ToDateTime("1/1/1990") : Convert.ToDateTime(txtDateFrom.Text); DateTime?DateTo = txtDateTo.Text == "" ? Convert.ToDateTime("12/31/2050") : Convert.ToDateTime(txtDateTo.Text); GenericCollection <ASNHeaderBE> listOfBE = objBC.GetASNArchiveFiles(DateFrom, DateTo); GenericCollection <ASNHeaderBE> DisplayList = new GenericCollection <ASNHeaderBE>(); //for (int i = 0; i < listOfBE.Count; i++) //{ // for (int j = 0; j < listOfBE.Count; j++) // { // TimeSpan? duration = listOfBE[i].TxnDate.Value - listOfBE[j].TxnDate.Value; // if (duration.Value.Duration().TotalSeconds < 20) // listOfBE[j].TxnDate = listOfBE[i].TxnDate; // } //} //for (int j = 0; j < listOfBE.Count; j++) //{ // if (DisplayList.Count == 0) // { // DisplayList.Add(j, listOfBE[j]); // } // else // { // bool duplicate = false; // for (int k = 0; k < DisplayList.Count; k++) // { // if (listOfBE[j].TxnDate == DisplayList[k].TxnDate) // duplicate = true; // } // if (!duplicate) // DisplayList.Add(DisplayList.Count, listOfBE[j]); // } //} //if (DisplayList.Count > 0) //{ // listOfBE = DisplayList; // DisplayList = null; //} listOfBE = PrepareASNList(listOfBE); for (int i = 0; i < listOfBE.Count; i++) { for (int j = 0; j < listOfBE.Count; j++) { if (listOfBE[i].LoadID == listOfBE[j].LoadID && listOfBE[i].PONumber == listOfBE[j].PONumber && listOfBE[j].ReceiverKey != "HEDBTS") { listOfBE[i].FMVCopy = listOfBE[j].ArchiveFile; } } } for (int j = 0; j < listOfBE.Count; j++) { if (DisplayList == null) { if (listOfBE[j].ReceiverKey == "HEDBTS") { DisplayList.Add(j, listOfBE[j]); } } else { bool duplicate = false; for (int k = 0; k < DisplayList.Count; k++) { if ((listOfBE[j].ReceiverKey == "HEDBTS" && listOfBE[j].LoadID == DisplayList[k].LoadID && listOfBE[j].PONumber == DisplayList[k].PONumber) || listOfBE[j].ReceiverKey != "HEDBTS") { duplicate = true; } } if (!duplicate) { DisplayList.Add(DisplayList.Count, listOfBE[j]); } } } if (DisplayList.Count > 0) { listOfBE = DisplayList; DisplayList = null; } if (drdServiceComponentPartnerSearch.SelectedIndex != 0) { for (int j = 0; j < listOfBE.Count; j++) { if (listOfBE[j].CM != drdServiceComponentPartnerSearch.SelectedValue) { DisplayList.Add(j, listOfBE[j]); } } if (DisplayList.Count > 0) { listOfBE = DisplayList; DisplayList = null; } } if (txtLoadID.Text != "") { for (int j = 0; j < listOfBE.Count; j++) { if (listOfBE[j].LoadID.ToLower() != txtLoadID.Text.Trim().ToLower()) { DisplayList.Add(j, listOfBE[j]); } } if (DisplayList.Count > 0) { listOfBE = DisplayList; DisplayList = null; } } if (txtPONumber.Text != "") { for (int j = 0; j < listOfBE.Count; j++) { if (listOfBE[j].PONumber.ToLower() != txtPONumber.Text.Trim().ToLower()) { DisplayList.Add(j, listOfBE[j]); } } if (DisplayList.Count > 0) { listOfBE = DisplayList; DisplayList = null; } } Session[vASNList] = listOfBE; if (ViewState[grdPageSize] != null) { gvASN.PageSize = Convert.ToInt32(ViewState[grdPageSize].ToString()); } else { gvASN.PageSize = 10; } lblRec.Text = Utils.GridRecDispMsg(gvASN.PageIndex, gvASN.PageSize, listOfBE.Count); gvASN.Visible = true; if (listOfBE != null && listOfBE.Count > 0) { rowPage.Visible = true; rowGrid.Visible = true; gvASN.DataSource = listOfBE; gvASN.DataBind(); lblRec.Text = Utils.GridRecDispMsg(gvASN.PageIndex, gvASN.PageSize, listOfBE.Count); gvASN.Visible = true; lblRec.Visible = true; } else { lblRec.Visible = false; rowGrid.Visible = false; rowPage.Visible = false; gvASN.Visible = false; gvASN.DataSource = null; gvASN.DataBind(); lblSearchError.Text = "No records found."; lblSearchError.Visible = true; } } catch (Exception ex) { lblSearchError.Text = ex.Message; lblSearchError.Visible = true; logFile.ErrorLogging(ex); } }
private void FillObject(ref object obj, Literacy lit, string json) { if (json == null || json.Length == 0) { return; } unsafe { fixed(char *p = json) { UnsafeJsonReader reader = new UnsafeJsonReader(p, json.Length); if (reader.IsEnd()) { return; } if (reader.Current == '{') { reader.MoveNext(); if (obj == null) { obj = new Dictionary <string, object>(); lit = Literacy.Cache(typeof(Dictionary <string, object>), true); } FillObject(obj, lit, reader); if (reader.Current != '}') { ThrowMissingCharException('}'); } } else if (reader.Current == '[') { reader.MoveNext(); if (obj == null) { obj = new ArrayList(); FillList((IList)obj, typeof(object), reader); } else if (obj is ArrayList) { FillList((IList)obj, lit.Type, reader); } else { var st = GenericCollection.GetList(lit.Type); if (st == null) { ThrowNoIList(lit.Type); } FillList((IList)obj, st.ElementType, reader); } if (reader.Current != ']') { ThrowMissingCharException(']'); } } else { ThrowException("起始字符:" + reader.Current); } reader.MoveNext(); if (reader.IsEnd()) { reader.Dispose(); } else { ThrowException("错误的结束字符:" + reader.Current); } } } }
private void BindShowShipment() { TransactionBC objBC = new TransactionBC(); PurchaseOrderBC objPucBC = new PurchaseOrderBC(); try { DateTime?DateFrom = txtDateFrom.Text == "" ? Convert.ToDateTime("1/1/1990") : Convert.ToDateTime(txtDateFrom.Text); DateTime?DateTo = txtDateTo.Text == "" ? Convert.ToDateTime("12/31/2050") : Convert.ToDateTime(txtDateTo.Text); TimeSpan?duration = null; // Assign values to a and b... if (DateFrom.HasValue && DateTo.HasValue) { duration = DateTo.Value - DateFrom.Value; } double days = duration.GetValueOrDefault().TotalDays; if (days > 2 && txtDO.Text.Trim() == "") { lblSearchError.Text = "Please select 2 Days difference between dates due to high volume of data or Provide DO Number to Search"; lblSearchError.Visible = true; return; } GenericCollection <ShowShipmentBE> listOfBE = objBC.GetShowShipment945Details("Get", TxtIDOC.Text.Trim(), txtDO.Text.Trim(), txtLoadID.Text.Trim(), drdStatus.SelectedValue, drdTxnType.SelectedValue, drdServiceComponentPartnerSearch.SelectedValue, txtPlant.Text.Trim(), txtOrderType.Text.Trim(), DateFrom, DateTo); foreach (ShowShipmentBE objExt1 in listOfBE) { if (objExt1.StageName == "SentPositive997ToPartner") { objExt1.Ack997Status = "pos997"; } if (objExt1.StageName == "SentNegative997ToPartner") { objExt1.Ack997Status = "neg997"; } if (objExt1.StageName == "SentPositiveEDI824ToPartner") { objExt1.Ack824Status = "pos824"; } if (objExt1.StageName == "SentNegativeEDI824ToPartner") { objExt1.Ack824Status = "Neg824"; } if (objExt1.StageName == "SendPositiveEDI824for945ToBatchPrimaryTransport") { objExt1.Ack824Status = "Pos824Batch"; } if (objExt1.StageName == "SendNegativeEDI824for945ToBatchPrimaryTransport") { objExt1.Ack824Status = "Neg824Batch"; } if (objExt1.StageName == "SendNegativeEDI824for945ToBatchSecondaryTransport") { objExt1.Ack824Status = "Neg824Batch"; } if (objExt1.StageName == "SendPositiveEDI824for945ToBatchSecondaryTransport") { objExt1.Ack824Status = "Pos824Batch"; } if (objExt1.StageName == "AperakAckSentToPartner") { objExt1.AckAperakStatus = "posAperak"; } if (objExt1.StageName == "AperakNAckSentToPartner") { objExt1.AckAperakStatus = "negAperak"; } if (objExt1.MDNStatus == "RcvdPositiveMDNFromPartner") { objExt1.MDNStatus = "PosMDN"; } if (objExt1.MDNStatus == "Error_RcvdNegativeMDNFromPartnerEx") { objExt1.MDNStatus = "NegMDN"; } if (objExt1.MDNStatus == "Error_MDNNotReceivedFromPartner") { objExt1.MDNStatus = "NoMDN"; } } foreach (ShowShipmentBE obj in listOfBE) { string PartnerName = objPucBC.GetPartnerName(obj.Plant); obj.CM = PartnerName == "" ? obj.CM : PartnerName; } Session[vSSList] = listOfBE; if (ViewState[grdPageSize] != null) { gvDO.PageSize = Convert.ToInt32(ViewState[grdPageSize].ToString()); } else { gvDO.PageSize = 10; } lblRec.Text = Utils.GridRecDispMsg(gvDO.PageIndex, gvDO.PageSize, listOfBE.Count); gvDO.Visible = true; if (listOfBE != null && listOfBE.Count > 0) { rowPage.Visible = true; rowGrid.Visible = true; gvDO.DataSource = listOfBE; gvDO.DataBind(); lblRec.Text = Utils.GridRecDispMsg(gvDO.PageIndex, gvDO.PageSize, listOfBE.Count); gvDO.Visible = true; lblRec.Visible = true; } else { lblRec.Visible = false; rowGrid.Visible = false; rowPage.Visible = false; gvDO.Visible = false; gvDO.DataSource = null; gvDO.DataBind(); lblSearchError.Text = "No records found."; lblSearchError.Visible = true; } } catch (Exception ex) { lblSearchError.Text = ex.Message; lblSearchError.Visible = true; logFile.ErrorLogging(ex); } }