/// <summary> /// Handles the action. /// </summary> /// <param name="actionString">The action string.</param> private void HandleAction(string actionString) { var action = ( ApplicationAction )Enum.Parse(typeof(ApplicationAction), actionString); switch (action) { case ApplicationAction.Delete: { var delete = new DeleteApplication(this); delete.ShowDialog( ); if (delete.ViewModel.PackagesDeleted) { RefreshAll( ); } } break; case ApplicationAction.Deploy: { var deploy = new DeployApplication(this); deploy.ShowDialog( ); } break; case ApplicationAction.Export: { var export = new ExportApplication(this); export.ShowDialog( ); } break; case ApplicationAction.Repair: { var repair = new RepairApplication(this); repair.ShowDialog( ); } break; default: { } break; } }
public bool InsertNewApplication(RepairApplication application) { bool result = false; try { using (var client = DbConfig.GetInstance()) { //ApplicationM.Id = client.Queryable<RepairApplication>().Max(it => it.Id).ObjToInt() + 1; result = client.Insert <RepairApplication>(application).ObjToBool(); } } catch (Exception) { throw; } return(result); }
public ActionResult ShowAllInOne(int appId, string type) { SummarizeDto SummarizeVM = new SummarizeDto(); if (String.Equals(type, "自修")) { Dispatch dispatchSheet = new Dispatch(); SelfRepairPlan selfRepairPlan = new SelfRepairPlan(); string dispatherName = string.Empty; string engineerName = string.Empty; RepairApplication application = repairDAL.AllInfo(appId, ref dispatchSheet, ref selfRepairPlan, ref dispatherName, ref engineerName); SummarizeVM.Instruction = dispatchSheet.Instruction; SummarizeVM.DispatchTime = dispatchSheet.CreatTime; SummarizeVM.Dispatcher = dispatherName; SummarizeVM.Engineer = engineerName; SummarizeVM.ApplicationDto = Mapper.Map <RepairApplication, ApplicationDto>(application); SummarizeVM.SelfRepairDto = Mapper.Map <SelfRepairPlan, SelfRepairPlanDto>(selfRepairPlan); } return(View(SummarizeVM)); }
public bool Finish(RepairApplication application, SelfRepairPlan selfRepairPlan) { bool result = false; using (var client = DbConfig.GetInstance()) { client.BeginTran(); client.CommandTimeOut = 30000; client.Update <RepairApplication>( new { FirstLocation = application.FirstLocation, SecondLocation = application.SecondLocation, ThirdLocation = application.ThirdLocation, FailureAppearance = application.FailureAppearance, FailureDescription = application.FailureDescription, Status = CurrentStatus.已总结.ToString(), SummarizeTime = DateTime.Now }, it => it.Id == application.Id); client.Update <SelfRepairPlan>( new { StartTime = selfRepairPlan.StartTime, TimeCost = selfRepairPlan.TimeCost, IsUseSpareParts = selfRepairPlan.IsUseSpareParts, Step = selfRepairPlan.Step, Tool = selfRepairPlan.Tool, SparePartsInfo = selfRepairPlan.SparePartsInfo, }, it => it.Id == selfRepairPlan.Id); try { client.CommitTran(); result = true; } catch (Exception) { throw; } } return(result); }