/// <summary> /// Get all the activities WorkOrder. /// </summary> /// <param name="modelWorkOrder">Model WorkOrder</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.PM.WorkOrder> SearchWorkOrder(SOFTTEK.SCMS.Entity.PM.WorkOrder modelWorkOrder) { List <SOFTTEK.SCMS.Entity.PM.WorkOrder> listWorkOrders = new List <SOFTTEK.SCMS.Entity.PM.WorkOrder>(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var results = dataSource.GetWorkOrders(modelWorkOrder); for (int i = 0; i < results.Count(); i++) { var modelTechnicalObject = new SCMS.Entity.PM.TechnicalObject { Identifier = results[i].TechnicalObject.Identifier }; var selectTechnicalObject = dataSource.GetTechnicalObjects(modelTechnicalObject); results[i].TechnicalObject = (from x in selectTechnicalObject select x).FirstOrDefault(); } listWorkOrders = results; } return listWorkOrders; }, "Retrieve the registered WorkOrders in system.")); }
/// <summary> /// Register MeasurementDocument. /// </summary> /// <param name="modelMeasurementDocument">modelMeasurementDocument Insert Model information MeasurementDocument</param> /// <returns>Registered MeasurementDocument information.</returns> public SOFTTEK.SCMS.Entity.PM.MeasurementDocument RegisterMeasurementDocument(SOFTTEK.SCMS.Entity.PM.MeasurementDocument modelMeasurementDocument) { SOFTTEK.SCMS.Entity.PM.MeasurementDocument modelInsert = new SOFTTEK.SCMS.Entity.PM.MeasurementDocument(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.InsertMeasurementDocument(modelMeasurementDocument); modelInsert = result; for (int i = 0; i < modelMeasurementDocument.Measures.Count(); i++) { var modelMeasure = new SCMS.Entity.PM.Measure(); modelMeasure = modelMeasurementDocument.Measures[i]; modelMeasure.Document = new SCMS.Entity.PM.MeasurementDocument { Identifier = modelInsert.Identifier }; var insertMeasure = dataSource.InsertMeasure(modelMeasure); var listMeasures = new List <SCMS.Entity.PM.Measure>(); listMeasures.Add(insertMeasure); modelInsert.Measures = listMeasures; } } return modelInsert; }, "Register an MeasurementDocument in system")); }
/// <summary> /// Get all the activities MaintenancePlan. /// </summary> /// <param name="modelMaintenancePlan">Model MaintenancePlan</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.PM.MaintenancePlan> SearchMaintenancePlan(SOFTTEK.SCMS.Entity.PM.MaintenancePlan modelMaintenancePlan) { List <SOFTTEK.SCMS.Entity.PM.MaintenancePlan> listMaintenancePlans = new List <SOFTTEK.SCMS.Entity.PM.MaintenancePlan>(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var results = dataSource.GetMaintenancePlans(modelMaintenancePlan); for (int i = 0; i < results.Count(); i++) { //results[i].WorkOrder var modelTask = new SCMS.Entity.PM.Task { WorkOrder = new SCMS.Entity.PM.WorkOrder { Identifier = results[i].WorkOrder }, Plan = new SCMS.Entity.PM.MaintenancePlan { Identifier = results[i].Identifier } }; var selectActivity = dataSource.GetTasks(modelTask); results[i].Activities = selectActivity; } listMaintenancePlans = results; } return listMaintenancePlans; }, "Retrieve the registered MaintenancePlans in system.")); }
public void TestCreateAdvise() { PMDataContext dc = new PMDataContext(null); Entity.PM.Advice a = new Entity.PM.Advice { Priority = "2", TechnicalObject = new Entity.PM.TechnicalObject { ExternalIdentifier = "000000000010013816", TechnicalLocation = new Entity.PM.TechnicalObject { ExternalIdentifier = "?0100000000000005587", TOType = Entity.PM.TechnicalObjectTypes.TechnicalObjectTypeTechnicalLocation }, TOType = Entity.PM.TechnicalObjectTypes.TechnicalObjectTypeEquipment }, Comments = "Test", Type = "", ExecutionStartAt = DateTime.Now.AddHours(-3), ExecutionFinishedAt = DateTime.Now.AddHours(-2), }; var s = dc.CreateAdvice(a); }
/// <summary> /// Get all the activities TechnicalObject. /// </summary> /// <param name="modelTechnicalObject">Model TechnicalObject</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.PM.WorkOrder> SearchWorkOrdesWithTechnicalObject(SOFTTEK.SCMS.Entity.PM.TechnicalObject modelTechnicalObject) { List <SOFTTEK.SCMS.Entity.PM.TechnicalObject> listTechnicalObjects = new List <SOFTTEK.SCMS.Entity.PM.TechnicalObject>(); List <SOFTTEK.SCMS.Entity.PM.WorkOrder> listWorkOrders = new List <SOFTTEK.SCMS.Entity.PM.WorkOrder>(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var modelWorkOrders = new SOFTTEK.SCMS.Entity.PM.WorkOrder(); //modelWorkOrders.TechnicalObject.Identifier = (resultsTechnical[0]).Identifier; var resultsWorkOrders = dataSource.GetWorkOrders(modelWorkOrders); var resultsTechnical = dataSource.GetTechnicalObjects(modelTechnicalObject); if (resultsTechnical == null) { resultsWorkOrders = (from x in resultsWorkOrders select x).ToList(); listWorkOrders = resultsWorkOrders; } } return listWorkOrders; }, "Retrieve the registered TechnicalObjects in system.")); }
public void TestNotification() { PMDataContext dc = new PMDataContext(null); TimeSpan t = new TimeSpan(1, 5, 56); Entity.PM.Notifications n = new Entity.PM.Notifications { ActualWork = string.Format("{0:00}:{1:00}:{2:00}", t.Hours, t.Minutes, t.Seconds), ExecutionStartAt = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), Priority = "2" }; var result = dc.SubmitWorkOrder(null); }
/// <summary> /// Register WorkOrder. /// </summary> /// <param name="modelWorkOrder">modelWorkOrder Insert Model information WorkOrder</param> /// <returns>Registered WorkOrder information.</returns> public SOFTTEK.SCMS.Entity.PM.WorkOrder RegisterWorkOrder(SOFTTEK.SCMS.Entity.PM.WorkOrder modelWorkOrder) { SOFTTEK.SCMS.Entity.PM.WorkOrder modelInsert = new SOFTTEK.SCMS.Entity.PM.WorkOrder(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.InsertWorkOrder(modelWorkOrder); modelInsert = result; } return modelInsert; }, "Register an WorkOrder in system")); }
/// <summary> /// Register ComponentReplacement. /// </summary> /// <param name="modelComponentReplacement">modelComponentReplacement Insert Model information ComponentReplacement</param> /// <returns>Registered activity information.</returns> public SOFTTEK.SCMS.Entity.PM.ComponentReplacement RegisterComponentReplacement(SOFTTEK.SCMS.Entity.PM.ComponentReplacement modelComponentReplacement) { SOFTTEK.SCMS.Entity.PM.ComponentReplacement modelInsert = new SOFTTEK.SCMS.Entity.PM.ComponentReplacement(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.InsertComponentReplacement(modelComponentReplacement); modelInsert = result; } return modelInsert; }, "Register an ComponentReplacement in system")); }
/// <summary> /// Update an MeasurementDocument. /// </summary> /// <param name="modelUpdate">model Update Model information MeasurementDocument</param> /// /// <param name="modelSearch">model filter information MeasurementDocument</param> /// <returns>Update MeasurementDocument information.</returns> public SOFTTEK.SCMS.Entity.PM.MeasurementDocument UpdateMeasurementDocument(SOFTTEK.SCMS.Entity.PM.MeasurementDocument modelUpdate, SOFTTEK.SCMS.Entity.PM.MeasurementDocument modelSearch) { SOFTTEK.SCMS.Entity.PM.MeasurementDocument modelRUpdate = new SOFTTEK.SCMS.Entity.PM.MeasurementDocument(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.UpdateMeasurementDocument(modelUpdate, modelSearch); modelRUpdate = result; } return modelRUpdate; }, "Update an MeasurementDocument in system")); }
/// <summary> /// Get all the activities MeasurementDocument. /// </summary> /// <param name="modelMeasurementDocument">Model MeasurementDocument</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.PM.MeasurementDocument> SearchMeasurementDocument(SOFTTEK.SCMS.Entity.PM.MeasurementDocument modelMeasurementDocument) { List <SOFTTEK.SCMS.Entity.PM.MeasurementDocument> listMeasurementDocument = new List <SOFTTEK.SCMS.Entity.PM.MeasurementDocument>(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var results = dataSource.GetMeasurementDocuments(modelMeasurementDocument); listMeasurementDocument = results; } return listMeasurementDocument; }, "Retrieve the registered MeasurementDocument in system.")); }
/// <summary> /// Register advice. /// </summary> /// <param name="modelAdvice">modelAdvice Insert Model information Advice</param> /// <returns>Registered activity information.</returns> public SOFTTEK.SCMS.Entity.PM.Advice RegisterAdvice(SOFTTEK.SCMS.Entity.PM.Advice modelAdvice) { //List<SOFTTEK.SCMS.Entity.PM.Advice> listReturn = new List<SOFTTEK.SCMS.Entity.PM.Advice>(); SOFTTEK.SCMS.Entity.PM.Advice modelInsert = new SOFTTEK.SCMS.Entity.PM.Advice(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.InsertAdvice(modelAdvice); modelInsert = result; //listReturn = result; } return modelInsert; }, "Register an Advices in system")); }
/// <summary> /// Get all the activities Advice. /// </summary> /// <param name="modelAdvice">Model Advice</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.PM.Advice> SearchAdvice(SOFTTEK.SCMS.Entity.PM.Advice modelAdvice) { List <SOFTTEK.SCMS.Entity.PM.Advice> listAdvices = new List <SOFTTEK.SCMS.Entity.PM.Advice>(); return(context.Execute(() => { using (dataSource = new PMDataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var results = dataSource.GetAdvices(modelAdvice); listAdvices = results; } return listAdvices; }, "Retrieve the registered Advices in system.")); }
public void TestGetTechnicalObjects() { PMDataContext dc = new PMDataContext(null); var s = dc.GetTechnicalObjects(); }
public void TestWorkOrders() { PMDataContext dc = new PMDataContext(null); dc.GetWorkOrdersInPeriod(); }
public void TestWorkOrder() { PMDataContext dc = new PMDataContext(null); var wo = dc.GetWorkOrdersInPeriod(); var result = dc.WorkOrderNotifications(wo.First().ExternalIdentifier); }
public void TestMasterDataRFC() { PMDataContext dc = new PMDataContext(null); var result = dc.GetMasterData(); var categories = result.GroupBy(p => p.Description).Select(g => g.ToList()).ToList(); }