public static void ValidateInsertCode(string code) { DocumentSubType documentSubType = new DocumentSubType(); documentSubType.Code = code; documentSubType.TestBeforeInsert(); }
private void ListViewCheckTypeAfterLabelEdit(object sender, LabelEditEventArgs e) { if (e.Label == null) { return; } string name = e.Label.Trim(); //DocumentSubType exist = // GlobalObjects.CasEnvironment.DocSubTypes.ToArray(). // Where(d => d.DocumentTypeId == _parentDocType.ItemID && d.FullName == name). // FirstOrDefault(); var dst = (DocumentSubTypeCollection)GlobalObjects.CasEnvironment.GetDictionary <DocumentSubType>(); var exist = dst.ToArray().FirstOrDefault(d => d.DocumentTypeId == _parentDocType.ItemId && d.FullName == name); //Проверка на то, не существует ли такой подтип для данного типа документов в словаре if (name == "" || exist != null) { e.CancelEdit = true; return; } DocumentSubType docSubType = ((DocumentSubType)listViewDocTypes.Items[e.Item].Tag); docSubType.FullName = e.Label.Trim(); GlobalObjects.CasEnvironment.NewKeeper.Save(docSubType); }
public static void ValidateUpdateCode(int codeID, string code) { DocumentSubType documentSubType = new DocumentSubType(); documentSubType.Code = code; documentSubType.ID = codeID; documentSubType.TestBeforeUpdate(); }
private void ListViewDocTypesBeforeLabelEdit(object sender, LabelEditEventArgs e) { DocumentSubType docSubType = (DocumentSubType)listViewDocTypes.Items[e.Item].Tag; if (docSubType.FullName == "AW" || docSubType.FullName == "AOC") { e.CancelEdit = true; return; } }
public static DocumentSubTypeDTO Convert(this DocumentSubType documentsubtype) { return(new DocumentSubTypeDTO { ItemId = documentsubtype.ItemId, IsDeleted = documentsubtype.IsDeleted, Updated = documentsubtype.Updated, CorrectorId = documentsubtype.CorrectorId, Name = documentsubtype.FullName, DocumentTypeId = documentsubtype.DocumentTypeId, }); }
/// <summary> /// Добавление дополнительной информации /// </summary> /// <param name="destinationDateSet"></param> private void AddAdditionalDataToDataSet(AircraftGeneralDataDataSet destinationDateSet) { List <Document> aircraftDocs = GlobalObjects.DocumentCore.GetAircraftDocuments(_reportedAircraft); //DocumentSubType awType = // GlobalObjects.CasEnvironment.DocSubTypes.ToArray().Where(d => d.FullName == "AW").FirstOrDefault(); DocumentSubType awType = (DocumentSubType) GlobalObjects.CasEnvironment.GetDictionary <DocumentSubType>().ToArray().FirstOrDefault(d => d.FullName == "AW"); Document awDoc = awType != null?aircraftDocs.FirstOrDefault(d => d.DocumentSubType == awType) : null; string awUpTo = awDoc != null && awDoc.IssueValidTo ? awDoc.IssueDateValidTo.ToString(new GlobalTermsProvider()["DateFormat"].ToString()) : ""; string reportFooter = new GlobalTermsProvider()["ReportFooter"].ToString(); string reportFooterPrepared = new GlobalTermsProvider()["ReportFooterPrepared"].ToString(); string reportFooterLink = new GlobalTermsProvider()["ProductWebsite"].ToString(); destinationDateSet.AdditionalDataTAble.AddAdditionalDataTAbleRow(_reportTitle, OperatorLogotype, awUpTo, DateAsOf, reportFooter, reportFooterPrepared, reportFooterLink); }
private void ButtonAddClick(object sender, EventArgs e) { if (textBoxName.Text.Trim() == "") { return; } //Проверка на то, не существует ли такой подтип для данного типа документов в словаре //DocumentSubType exist = // GlobalObjects.CasEnvironment.DocSubTypes.ToArray(). // Where(d => d.DocumentTypeId == _parentDocType.ItemID && d.FullName == textBoxName.Text.Trim()). // FirstOrDefault(); var dst = (DocumentSubTypeCollection)GlobalObjects.CasEnvironment.GetDictionary <DocumentSubType>(); var exist = dst.ToArray().FirstOrDefault(d => d.DocumentTypeId == _parentDocType.ItemId && d.FullName == textBoxName.Text.Trim()); if (exist != null) { MessageBox.Show("Item with this name is already exist.", new GlobalTermsProvider()["SystemName"].ToString()); return; } DocumentSubType newSubType = new DocumentSubType { DocumentTypeId = _parentDocType.ItemId, FullName = textBoxName.Text.Trim() }; ListViewItem listViewItem = new ListViewItem(newSubType.ToString()) { Tag = newSubType }; listViewDocTypes.Items.Add(listViewItem); textBoxName.Text = ""; GlobalObjects.CasEnvironment.NewKeeper.Save(newSubType); dst.Add(newSubType); }
public static string DocumentSubTypeCodeGenerator(int DocumentTypeID) { List <DocumentSubType> dstList = DocumentSubType.Select().Where(d => d.DocumentTypeID == DocumentTypeID).OrderBy(d => d.Code).ToList(); Broker.DataAccess.DocumentType dt = Broker.DataAccess.DocumentType.Get(DocumentTypeID); if (dstList.Count == 0) { return(dt.Code + "001"); } else { string code = dstList.Last().Code.Substring(dt.Code.Length); int length = code.Length; string newCode = (int.Parse(code) + 1).ToString(); while (newCode.Length < length) { newCode = "0" + newCode; } return(dt.Code + newCode); } }
/// <summary> /// Добавляется элемент в таблицу данных /// </summary> /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param> private void AddAircraftToDataset(AircraftGeneralDataDataSet destinationDataSet) { if (_reportedAircraft == null) { return; } var reportAircraftLifeLenght = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(_reportedAircraft); var aircraftDocs = GlobalObjects.DocumentCore.GetAircraftDocuments(_reportedAircraft); var operatorDocs = GlobalObjects.DocumentCore.GetDocuments(GlobalObjects.CasEnvironment.Operators.First(o => o.ItemId == _reportedAircraft.OperatorId), DocumentType.Certificate, true); //DocumentSubType aocType = // GlobalObjects.CasEnvironment.DocSubTypes.ToArray().Where(d => d.FullName == "AOC").FirstOrDefault(); DocumentSubType aocType = (DocumentSubType) GlobalObjects.CasEnvironment.GetDictionary <DocumentSubType>().ToArray().FirstOrDefault(d => d.FullName == "AOC"); if (aocType != null) { operatorDocs.Remove(operatorDocs.FirstOrDefault(d => d.DocumentSubType == aocType)); } string manufactureDate = _reportedAircraft.ManufactureDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString()); int sinceNewHours = reportAircraftLifeLenght.Hours != null ? (int)reportAircraftLifeLenght.Hours : 0; int sinceNewCycles = reportAircraftLifeLenght.Cycles != null ? (int)reportAircraftLifeLenght.Cycles : 0; destinationDataSet.AircraftDataTable.AddAircraftDataTableRow(_reportedAircraft.SerialNumber, manufactureDate, sinceNewHours, sinceNewCycles, _reportedAircraft.RegistrationNumber, _reportedAircraft.Model.ToString(), _reportedAircraft.LineNumber, _reportedAircraft.VariableNumber, _reportedAircraft.MaxTakeOffCrossWeight.ToString(), _reportedAircraft.MaxTaxiWeight.ToString(), _reportedAircraft.MaxZeroFuelWeight.ToString(), _reportedAircraft.MaxLandingWeight.ToString(), _reportedAircraft.BasicEmptyWeight.ToString(), _reportedAircraft.OperationalEmptyWeight.ToString(), _reportedAircraft.FuelCapacity, _reportedAircraft.MaxCruiseAltitude, _reportedAircraft.CruiseFuelFlow, _reportedAircraft.CargoCapacityContainer, _reportedAircraft.AircraftAddress24Bit, _reportedAircraft.ELTIdHexCode); destinationDataSet.InteriorConfiguration.AddInteriorConfigurationRow(_reportedAircraft.CockpitSeating, _reportedAircraft.Galleys, _reportedAircraft.Lavatory, _reportedAircraft.SeatingEconomy.ToString(), _reportedAircraft.Oven, _reportedAircraft.Boiler, _reportedAircraft.AirStairsDoors); var aircraftEquipment = _reportedAircraft.AircraftEquipments.Where(a => a.AircraftEquipmetType == AircraftEquipmetType.Equipmet); foreach (var equipment in aircraftEquipment) { destinationDataSet.AircraftSpecialEquipmentTable.AddAircraftSpecialEquipmentTableRow( equipment.AircraftOtherParameter.ToString(), equipment.Description); } var aircraftApproval = _reportedAircraft.AircraftEquipments.Where(a => a.AircraftEquipmetType == AircraftEquipmetType.TapeOfOperationApproval); foreach (var approval in aircraftApproval) { destinationDataSet.AircraftCertificatesTable.AddAircraftCertificatesTableRow( approval.AircraftOtherParameter.ToString(), approval.Description); } }
protected void dvDataSource_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { DocumentSubType dst = e.InputParameters["entityToInsert"] as DocumentSubType; DocumentSubTypeController.ValidateInsertCode(dst.Code); }
protected void dvDataSource_Updating(object sender, ObjectDataSourceMethodEventArgs e) { DocumentSubType dst = e.InputParameters["newEntity"] as DocumentSubType; DocumentSubTypeController.ValidateUpdateCode(dst.ID, dst.Code); }