public GINReportDataCollection(GINReportInfo ginReportInfo, ILookupSource lookupSource) { _site = null; List.Add( new GINReportData( ginReportInfo.GINNo, ginReportInfo.DateIssued, lookupSource.GetLookup("Warehouse")[ginReportInfo.WarehouseId], lookupSource.GetLookup("Client")[ginReportInfo.ClientId], lookupSource.GetLookup("ClientId")[ginReportInfo.ClientId], lookupSource.GetLookup("PUNAgent")[ginReportInfo.PickupNoticeAgentId], ginReportInfo.PUNAIdNo, lookupSource.GetLookup("NIDType")[ginReportInfo.PUNANIDType], lookupSource.GetLookup("CommodityGrade")[ginReportInfo.CommodityGradeId], ginReportInfo.Quantity, ginReportInfo.Weight, ginReportInfo.ScaleTicketNo, lookupSource.GetLookup("BagType")[ginReportInfo.BagType], ginReportInfo.Bags, false, string.Empty, string.Empty, ginReportInfo.DriverName, ginReportInfo.LicenseNo, ginReportInfo.IssuedBy, ginReportInfo.PlateNo, lookupSource.GetLookup("GINStatus")[ginReportInfo.Status] )); }
private void SetCatalogData() { List <IDataIdentifier> ids = null; try { IDataFilter filter = SearchConditionSelector1.DataFilter; foreach (DataFilterParameter parameter in filter.Parameters) { if (parameter.Name == "WarehouseId") { filter.SetCondition( new DataFilterCondition( parameter, FilterConditionType.Comparison, string.Empty, ginLookup.GetLookup("CurrentWarehouse")["Id"])); } else { filter.SetCondition(SearchConditionSelector1[parameter.Name]); } } ids = GINProcessBLL.SearchGIN(filter); } catch { ids = new List <IDataIdentifier>(); } string buffer = string.Empty; foreach (IDataIdentifier identifier in ids) { buffer += identifier.Preview.DocumentElement.InnerXml; } string ginProcessSet = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <Catalog>" + buffer + "</Catalog>"; xdsGINSource.Data = ginProcessSet; gvGIN.DataBind(); }
public static void NotifyGIN(Guid truckId) { IGINProcess ginProcess = GetGINProcess(true); ILookupSource lookup = ginProcess.LookupSource; GINProcessInfo ginProcessInfo = ginProcess.GINProcessInformation; GINTruckInfo truck = (from trk in ginProcessInfo.Trucks where trk.TruckId == truckId select trk).Single(); ECXCD.WR wr = new WarehouseApplication.ECXCD.WR(); wr.SaveGIN( truck.GIN.GINId, truck.GIN.GINNo, ginProcessInfo.PickupNoticeId, Convert.ToDouble(truck.GIN.GrossWeight), Convert.ToDouble(truck.GIN.NetWeight), Convert.ToDouble(truck.GIN.Quantity), truck.GIN.DateIssued, truck.GIN.SignedByClient, truck.GIN.DateApproved, truck.GIN.ApprovedBy, truck.Load.Remark + Environment.NewLine + truck.Weight.Remark, lookup.GetLookup("GINStatus")[truck.GIN.Status]); }
protected string GetStatusName(object status) { return(ginLookup.GetLookup("Status")[int.Parse(status.ToString())]); }
public void Setup() { string validationGroup = string.Empty; if (!driver.SuppressValidationSummary) { validationGroup = (driver.ValidationGroup == null || driver.ValidationGroup == string.Empty) ? driver.Title : driver.ValidationGroup; } ValidationMessage.ValidationGroup = validationGroup; btnOk.ValidationGroup = validationGroup; List <TableRow> rowsToRemove = new List <TableRow>(); foreach (TableRow tableRow in RenderTable.Rows) { if ((tableRow.ID != "CaptionRow") && (tableRow.ID != "CommandRow") && (tableRow.ID != "MessageRow")) { rowsToRemove.Add(tableRow); } } foreach (TableRow tableRow in rowsToRemove) { RenderTable.Rows.Remove(tableRow); } ExtenderPanel.Controls.Clear(); //foreach (GINColumnDescriptor column in driver.Columns) var nonCascadingColumns = from column in driver.Columns where column.IsViewable && (from child in driver.Columns select child).All(child => !child.IsCascadedLookup || (child.IsCascadedLookup && (child.ParentLookup != column.Name))) select column; foreach (GINColumnDescriptor column in nonCascadingColumns) { if (column.IsCDDExtender) { //string parentColumnName = (from pcr in column.ExtendedColumns where pcr.Role=="Parent" select pcr.Name).Single(); //GINColumnDescriptor parentColumn = driver.Columns.Find(parent=>parent.Name == parentColumnName); //string childColumnName = (from pcr in column.ExtendedColumns where pcr.Role=="Child" select pcr.Name).Single(); //GINColumnDescriptor childColumn = driver.Columns.Find(child=>child.Name == childColumnName); //CascadingDropDown cddExtender = new CascadingDropDown(); //cddExtender.ID = string.Format("cddExtender_{0}", column.Name); //cddExtender.Category = parentColumn.Lookup; //cddExtender.Enabled = true; //cddExtender.LoadingText = "Please wait..."; //Control childContainingControl = FindCell(string.Format("ddl{0}", childColumnName)); //cddExtender.ParentControlID = string.Format("ddl{0}", parentColumnName); //cddExtender.TargetControlID = string.Format("ddl{0}", childColumnName); //cddExtender.ServicePath = column.ServicePath; //cddExtender.ServiceMethod = column.ServiceMethod; //childContainingControl.Controls.Add(cddExtender); GINColumnDescriptorReference parentReference = (from pcr in column.ExtendedColumns where pcr.Role == "Parent" select pcr).Single(); string parentColumnName = parentReference.Name; GINColumnDescriptor parentColumn = driver.Columns.Find(parent => parent.Name == parentColumnName); string childColumnName = (from pcr in column.ExtendedColumns where pcr.Role == "Child" select pcr.Name).Single(); GINColumnDescriptor childColumn = driver.Columns.Find(child => child.Name == childColumnName); CascadingDropDown cddExtender = new CascadingDropDown(); cddExtender.ID = string.Format("cddExtender_{0}", childColumnName); if ((parentColumn == null) && (parentReference.UseContextKey)) { cddExtender.ContextKey = lookup.GetLookup(parentReference.ContextKeyLookup)[parentReference.ContextKeyName]; } cddExtender.Category = (parentColumn == null)?"undefined":parentColumn.Lookup; cddExtender.Enabled = true; cddExtender.LoadingText = "Please wait..."; cddExtender.PromptText = string.Format("[select {0}]", childColumnName); cddExtender.PromptValue = DALManager.NullFinder.GetNullValue(childColumn.DataType).ToString(); Control childContainingControl = FindCell(string.Format("ddl{0}", childColumnName)); if (parentColumnName != string.Empty) { cddExtender.ParentControlID = string.Format("ddl{0}", parentColumnName); } cddExtender.TargetControlID = string.Format("ddl{0}", childColumnName); cddExtender.ServicePath = column.ServicePath; cddExtender.ServiceMethod = column.ServiceMethod; cddExtender.DataBinding += new EventHandler(cddExtender_DataBinding); childContainingControl.Controls.Add(cddExtender); continue; } if (column.IsTextChangeExtender) { string publisherColumnName = (from pcr in column.ExtendedColumns where pcr.Role == "Publisher" select pcr.Name).Single(); TextBox txtPublisher = (TextBox)FindColumnControl(string.Format("txt{0}", publisherColumnName)); txtPublisher.AutoPostBack = true; txtPublisher.TextChanged += new EventHandler(txtPublisher_TextChanged); UpdatePanelControlTrigger trigger = new AsyncPostBackTrigger(); trigger.ControlID = txtPublisher.ID; TextChangeUpdatePanel.Triggers.Add(trigger); continue; } TableRow row = new TableRow(); int index = RenderTable.Rows.Count - 1; RenderTable.Rows.AddAt(index, row); TableCell cell = new TableCell(); if (index % 2 == 0) { cell.CssClass = alternateRowClass; } cell.Width = new Unit(35, UnitType.Percentage); row.Cells.Add(cell); Literal caption = new Literal(); caption.Text = column.Header; cell.Controls.Add(caption); cell = new TableCell(); if (index % 2 == 0) { cell.CssClass = alternateRowClass; } cell.Width = new Unit(65, UnitType.Percentage); row.Cells.Add(cell); if (column.IsCascadedLookup) { GINColumnDescriptor parentColumn = driver.Columns.Find(parent => parent.Name == column.ParentLookup); IGINColumnRenderer renderer = parentColumn.AttachedRenderer; if (parentColumn.IsLookup) { renderer.Lookup = Lookup; } renderer.DataSource = DataSource; WebControl parentControl = renderer.RenderInEditor(); parentControl.ID = string.Format("cddParent_{0}", parentColumn.Name); parentControl.Width = new Unit(50, UnitType.Percentage); renderer = column.AttachedRenderer; renderer.DataSource = DataSource; WebControl childControl = renderer.RenderInEditor(); childControl.ID = string.Format("cddChild_{0}", column.Name); childControl.Width = new Unit(50, UnitType.Percentage); Panel uPan = new Panel(); uPan.Controls.Add(parentControl); uPan.Controls.Add(childControl); CascadingDropDown cddExtender = new CascadingDropDown(); cddExtender.ID = string.Format("cddExtender_{0}", column.Name); cddExtender.Category = parentColumn.Lookup; cddExtender.LoadingText = "Please wait..."; cddExtender.ParentControlID = parentControl.ID; cddExtender.TargetControlID = childControl.ID; cddExtender.ServicePath = column.ServicePath; cddExtender.ServiceMethod = column.ServiceMethod; uPan.Controls.Add(cddExtender); cell.Controls.Add(uPan); row.Cells.Add(cell); } else { IGINColumnRenderer renderer = column.AttachedRenderer; if (column.IsLookup) { renderer.Lookup = Lookup; } renderer.DataSource = DataSource; WebControl ctrl = renderer.RenderInEditor(); List <BaseValidator> validators = SetValidationGroup(ctrl); cell.Controls.Add(ctrl); cell = new TableCell(); foreach (BaseValidator validator in validators) { cell.Controls.Add(validator); //ctrl.Controls.Remove(validator); } row.Cells.Add(cell); } } }
public virtual WebControl RenderInEditor() { if (column.IsCDDExtender || column.IsTextChangeExtender) { return(null); } if (!column.IsEditable || column.IsStatic) { Label lbl = new Label(); lbl.Width = new Unit(100, UnitType.Percentage); if (column.IsStatic) { lbl.Text = column.Text; } else { lbl.DataBinding += new EventHandler(lbl_DataBinding); } return(lbl); } if (column.IsLookup) { DropDownList ddl = new DropDownList(); ddl.Width = new Unit(100, UnitType.Percentage); ddl.DataBinding += new EventHandler(ddl_DataBinding); ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); IDictionary <object, string> dictionary = lookup.GetLookup(column.Lookup); foreach (object key in dictionary.Keys) { ListItem item = new ListItem(dictionary[key], key.ToString()); ddl.Items.Add(item); } var validationRule = from rule in column.Rules where (rule.ValidationType == "Required") && ((RequiredValidationRule)rule).IsRequired select rule; if (validationRule.Count() == 0) { ddl.Items.Add(new ListItem(string.Empty, NullFinder.GetNullValue(column.DataType).ToString())); } ddl.ID = string.Format("ddl{0}", column.Name); return(ddl); } if (column.IsCascadedLookup)// || column.IsCDDExtended) { DropDownList ddl = new DropDownList(); ddl.ID = string.Format("ddl{0}", column.Name); ddl.Width = new Unit(100, UnitType.Percentage); ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); return(ddl); } else { Panel ph = new Panel(); TextBox txt = new TextBox(); txt.Width = new Unit(100, UnitType.Percentage); txt.DataBinding += new EventHandler(txt_DataBinding); txt.TextChanged += new EventHandler(txt_TextChanged); txt.ID = string.Format("txt{0}", column.Name); if (column.IsLongText) { txt.TextMode = TextBoxMode.MultiLine; } ph.Controls.Add(txt); //for each rule specified in the column descriptor //the renderer attaches the appropriate validator control foreach (ValidationRule rule in column.Rules) { BaseValidator validationControl = null; switch (rule.ValidationType) { case "Required": if (((RequiredValidationRule)rule).IsRequired) { validationControl = new RequiredFieldValidator(); } break; case "Pattern": RegularExpressionValidator validator = new RegularExpressionValidator(); validator.ValidationExpression = ((PatternValidationRule)rule).Pattern; validationControl = validator; break; case "Range": RangeValidator rangeValidator = new RangeValidator(); RangeValidationRule rangeRule = (RangeValidationRule)rule; rangeValidator.MinimumValue = rangeRule.LeftBoundary; rangeValidator.MaximumValue = rangeRule.RightBoundary; validationControl = rangeValidator; break; case "Compare": CompareValidator compareValidator = new CompareValidator(); CompareValidationRule compareRule = (CompareValidationRule)rule; compareValidator.Operator = compareRule.CompareOperator; compareValidator.Type = compareRule.RuleDataType; compareValidator.ValueToCompare = compareRule.ValueToCompare; validationControl = compareValidator; break; } if (validationControl != null) { validationControl.ValidationGroup = "GINDataEditor"; validationControl.ControlToValidate = txt.ID; validationControl.ErrorMessage = rule.ErrorMessage; validationControl.Text = "*"; ph.Controls.Add(validationControl); } } return(ph); } }
public static void CachePickupNotices() { List <Guid> cachedPunIds = new List <Guid>(); ECXCD.WR wr = new WarehouseApplication.ECXCD.WR(); List <ECXCD.CPickUpNotice> importedPuns = new List <WarehouseApplication.ECXCD.CPickUpNotice>(wr.GetPun()); int importedPunsCount = importedPuns.Count; if (importedPunsCount == 0) { return; } List <PickupNoticeInformation> cachedPuns = new List <PickupNoticeInformation>( from ipun in importedPuns where ipun.WarehouseId == new Guid(StaticLookupSource.GetLookup("CurrentWarehouse")["Id"]) select new PickupNoticeInformation() { ClientId = ipun.ClientId, MemberId = ipun.MemberId, RepId = ipun.RepId, CommodityGradeId = ipun.CommodityGradeId, ProductionYear = ipun.ProductionYear, ExpectedPickupDate = ipun.ExpectedPickupDate, ExpirationDate = ipun.ExpirationDate, PickupNoticeId = ipun.PickupNoticeId, WarehouseId = ipun.WarehouseId, Quantity = ipun.Quantity, Weight = ipun.Weight, Status = 0 }); int cachedPunsCount = cachedPuns.Count; Dictionary <string, object> contextParameters = new Dictionary <string, object>(); contextParameters.Add("CurrentUser", new Guid(SystemLookup.LookupSource.GetLookup("CurrentUser")["Id"])); cachedPuns.ForEach( delegate(PickupNoticeInformation pun) { pun.PickupNoticeAgents.AddRange( from ipun in importedPuns where ipun.PickupNoticeId == pun.PickupNoticeId from ipuna in ipun.PickupNoticeAgents select new PickupNoticeInformation.PickupNoticeAgentInformation() { AgentName = ipuna.AgentName, AgentTel = ipuna.AgentTel, Id = Guid.NewGuid(), NIDNumber = ipuna.NIDNumber, NIDType = ipuna.NIDType, PickupNoticeId = ipuna.PickupNoticeId, Status = ipuna.Status }); pun.WarehouseReceipts.AddRange( from ipun in importedPuns where ipun.PickupNoticeId == pun.PickupNoticeId from iwr in ipun.WarehouseReciepts select new PickupNoticeInformation.WarehouseReceiptInformation() { Bags = iwr.Bags, BagType = iwr.BagType, GRNID = iwr.GRNID, GRNNo = iwr.GRNNo, Id = iwr.Id, PickupNoticeId = iwr.PickupNoticeId, Quantity = Convert.ToDecimal(iwr.Quantity), ShedId = iwr.ShedId, WarehouseReceiptId = iwr.WarehouseRecieptId, Weight = Convert.ToDecimal(iwr.Weight) }); Queue <object[]> queue = new Queue <object[]>(); queue.Enqueue(new object[] { pun, "spImportPUN" }); pun.PickupNoticeAgents.ForEach(puna => queue.Enqueue(new object[] { puna, "spImportPUNAgent" })); pun.WarehouseReceipts.ForEach(wrct => queue.Enqueue(new object[] { wrct, "spImportWarehouseReceipt" })); SqlTransaction transaction = null; try { transaction = PersistenceTransactionFactory.CreatePersistenceTransaction().Persist(queue, contextParameters); transaction.Commit(); cachedPunIds.Add(pun.PickupNoticeId); } catch (Exception ex) { try { if (transaction != null) { transaction.Rollback(); } } catch (Exception) { } } }); wr.AcknowledgePuns(cachedPunIds.ToArray()); }