public static int EliminarNodosPorPadre(int id) { ControlPlan Plan = new ControlPlan(); PartePlan PartePadre = new PartePlan(id); return(Plan.EliminarNodosPorPadre(PartePadre, 1)); }
public static int CopiarPlan(string PLAN_Interno, string PLAN_Descripcion) { PlanTrabajo Plan = new PlanTrabajo(int.Parse(PLAN_Interno)); ControlPlan ControlPlan = new ControlPlan(); return(ControlPlan.CopiarPlan(Plan, PLAN_Descripcion, 1)); }
public static List <Nodo> ObtenerNodos(Nodo Nodo) { List <Nodo> ArrayNodo = new List <Nodo>(); ControlPlan Plan = new ControlPlan(); List <PartePlan> Partes = Plan.ObterPartesPorOrigen(int.Parse(Nodo.attr.id)); if (Partes.Count() != 0) { foreach (PartePlan Parte in Partes) { Nodo _Nodo = new Nodo(); _Nodo.data = Parte.PART_Nombre; _Nodo.state = "false"; _Nodo.attr = new AtributoNodo { id = Parte.PART_Interno.ToString(), selected = true }; _Nodo.children = ObtenerNodos(_Nodo); ArrayNodo.Add(_Nodo); } return(ArrayNodo); } else { return(null); } }
protected string ObtenerNombrePlan() { ControlPlan Plan = new ControlPlan(); PlanTrabajo ObjPlan = new PlanTrabajo(Interno); ObjPlan = Plan.ObtenerPlanPorId(ObjPlan); return(ObjPlan.PLAN_Descripcion); }
public SpecificationCreationDialogViewModel(IDataService <LabDbEntities> labDbData) : base() { _labDbData = labDbData; CurrentIssue = ""; Description = ""; CancelCommand = new DelegateCommand <Window>( parent => { parent.DialogResult = false; }); ConfirmCommand = new DelegateCommand <Window>( parent => { SpecificationInstance = new Specification() { Description = Description, Name = Name }; Std tempStd = _labDbData.RunQuery(new StandardQuery() { Name = Name }); if (tempStd == null) { SpecificationInstance.Standard = new Std() { CurrentIssue = CurrentIssue, Name = Name, OrganizationID = _oem.ID } } ; else { SpecificationInstance.StandardID = tempStd.ID; } SpecificationVersion tempMain = new SpecificationVersion(); tempMain.Name = "Generica"; tempMain.IsMain = true; ControlPlan tempControlPlan = new ControlPlan(); tempControlPlan.Name = "Completo"; tempControlPlan.IsDefault = true; SpecificationInstance.ControlPlans.Add(tempControlPlan); SpecificationInstance.SpecificationVersions.Add(tempMain); parent.DialogResult = true; }, parent => !HasErrors); Oem = null; }
public void ApplyControlPlan(IEnumerable <ISelectableRequirement> reqList, ControlPlan conPlan) { IEnumerable <ControlPlanItem> itemList = conPlan.GetControlPlanItems(); foreach (ISelectableRequirement isr in reqList) { isr.IsSelected = itemList.First(cpi => cpi.RequirementID == isr.RequirementInstance.ID || cpi.RequirementID == isr.RequirementInstance.OverriddenID) .IsSelected; } }
public static int RetrievePackingMonthIdByCpHeaderId(int cpHeaderId) { using (AppDb context = new AppDb()) { ControlPlan controlPlan = context.ControlPlans.FirstOrDefault(p => p.Id == cpHeaderId); if (controlPlan != null) { return(Convert.ToInt32(controlPlan.PackingMonth)); } } return(0); }
public static int InsertarMantenimientoInicial(string PLAN_Interno) { ControlPlan ControlPlan = new ControlPlan(); PlanTrabajo Plan = new PlanTrabajo(int.Parse(PLAN_Interno)); var opcItem = false; if (opc == "equi") { opcItem = true; } return(ControlPlan.InsertarMantenimientoInicial(Plan, items, opcItem, 1)); }
protected void LlenarPlanes() { ControlPlan ControlPlan = new ControlPlan(); List <PlanTrabajo> Planes = ControlPlan.ObtenerPlanes(); int i = 1; foreach (PlanTrabajo Plan in Planes) { this.combobox.Items.Insert(i, Plan.PLAN_Descripcion); this.combobox.Items[i].Value = Plan.PLAN_Interno.ToString(); i++; } }
public static List <PlanTrabajo> listaPlanesP(string TamanioPagina, String Pagina) { ControlPlan CP = new ControlPlan(); List <PlanTrabajo> Planes = CP.ObtenerPlanesP(int.Parse(TamanioPagina), int.Parse(Pagina)); List <PlanTrabajo> planes = new List <PlanTrabajo>(); foreach (PlanTrabajo plan in Planes) { plan.PLAN_ID = SeguridadWeb.Encriptar(plan.PLAN_Interno.ToString()); plan.PLAN_ID = plan.PLAN_ID.Replace("+", "_"); planes.Add(plan); } return(planes); }
public static int EliminarPlanes(string IDs) { int resultado = 0; string[] IDEquipos = IDs.Split('|'); ControlPlan CtrlPlan = new ControlPlan(); foreach (string ID in IDEquipos) { PlanTrabajo PlanTrabajo = new PlanTrabajo(int.Parse(ID)); if (CtrlPlan.EliminarPlan(PlanTrabajo, 1) > 0) { resultado++; } } return(resultado); }
public static int InsertarNodo(int?idnodo, string name, int idnodopadre, Boolean op) { PartePlan Parte = new PartePlan(); ControlPlan Plan = new ControlPlan(); Parte.PART_Nombre = name; Parte.PLAN_Interno = Interno; if (op) { Parte.PART_Interno = null; Parte.PART_Origen = idnodopadre; return(Plan.InsertaParte(Parte, 1, null)); } else { Parte.PART_Interno = idnodo; Parte.PART_Origen = idnodopadre; return(Plan.InsertaParte(Parte, null, 1)); } }
public static List <Nodo> ObtenerNodoPrincipal(string id) { List <Nodo> ArrayNodo = new List <Nodo>(); ControlPlan Plan = new ControlPlan(); int? Origen = Plan.ObtenerParteOrigenPLan(int.Parse(id)); PartePlan ParteOrigen = new PartePlan(); ParteOrigen.PART_Interno = Origen; ParteOrigen = Plan.ObtenerPartePorId(ParteOrigen); Nodo NodoP = new Nodo(); NodoP.data = ParteOrigen.PART_Nombre; NodoP.state = "false"; NodoP.attr = new AtributoNodo { id = Origen.ToString(), selected = false }; NodoP.children = ObtenerNodos(NodoP); ArrayNodo.Add(NodoP); return(ArrayNodo); }
protected void btnII_OnClick(object sender, EventArgs e) { try { ASPxButton btn = (sender as ASPxButton); ControlPlan cp = ControlPlanRepository.RetrieveControlPlanById(Convert.ToInt32(Request.QueryString["CpId"])); hfDocCtrlDetail["docType"] = "CPII"; grvDocControlDetail.DataSource = null; grvDocControlDetail.DataSource = ControlPlanRepository.RetrieveDocumentByDocTypeAndStationIdII("CPII", Convert.ToInt32(btn.CommandArgument), cp.PackingMonth, Convert.ToInt32(cp.AssemblyModelId)); grvDocControlDetail.DataBind(); Session["StationId"] = Convert.ToInt32(btn.CommandArgument); popupDocControl.HeaderText = "Document Control - Inspection Instruction"; popupDocControl.ShowOnPageLoad = true; } catch (Exception ex) { LoggerHelper.LogError(ex); } }
public static int GuardarPlan(string PLAN_Interno, string PLAN_Descripcion, string PLAN_Regimen, string PLAN_UnidadLecturas) { PlanTrabajo PlanTrabajo = new PlanTrabajo(); if (PLAN_Interno == "") { PlanTrabajo.PLAN_Interno = null; } else { PlanTrabajo.PLAN_Interno = int.Parse(PLAN_Interno); } PlanTrabajo.PLAN_Descripcion = PLAN_Descripcion; PlanTrabajo.PLAN_Regimen = PLAN_Regimen; if (PLAN_UnidadLecturas == "") { PlanTrabajo.PLAN_UnidadLecturas = null; } else { PlanTrabajo.PLAN_UnidadLecturas = PLAN_UnidadLecturas; } ControlPlan ctrlPlan = new ControlPlan(); if (PLAN_Interno == "") { return(ctrlPlan.InsertarPlan(PlanTrabajo, 1, null)); } else if (PLAN_Interno != "") { return(ctrlPlan.InsertarPlan(PlanTrabajo, null, 1)); } else { return(0); } }
public SpecificationEditViewModel(IDataService <LabDbEntities> labDbData, IEventAggregator aggregator, IReportService reportService) { _labDbData = labDbData; _eventAggregator = aggregator; _reportService = reportService; AddControlPlanCommand = new DelegateCommand( () => { ControlPlan temp = _instance.AddControlPlan(); RaisePropertyChanged("ControlPlanList"); }); AddFileCommand = new DelegateCommand( () => { OpenFileDialog fileDialog = new OpenFileDialog { Multiselect = true }; if (fileDialog.ShowDialog() == DialogResult.OK) { foreach (string pth in fileDialog.FileNames) { StandardFile temp = new StandardFile { Path = pth, Description = "", StandardID = _instance.StandardID }; temp.Create(); } RaisePropertyChanged("FileList"); } }, () => Thread.CurrentPrincipal.IsInRole(UserRoleNames.SpecificationEdit)); AddTestCommand = new DelegateCommand <MethodVariant>( mtd => { Requirement newReq = _reportService.GenerateRequirement(mtd); _instance.AddMethod(newReq); _eventAggregator.GetEvent <SpecificationMethodListChanged>() .Publish(_instance); }, mtd => CanEdit); AddVersionCommand = new DelegateCommand( () => { SpecificationVersion temp = new SpecificationVersion { IsMain = false, Name = "Nuova versione", SpecificationID = _instance.ID }; temp.Create(); RaisePropertyChanged("VersionList"); }, () => CanEdit); CloseAddMethodViewCommand = new DelegateCommand( () => { NavigationToken token = new NavigationToken(SpecificationViewNames.SpecificationVersionList, null, RegionNames.SpecificationVersionTestListEditRegion); _eventAggregator.GetEvent <NavigationRequested>() .Publish(token); }); OpenFileCommand = new DelegateCommand( () => { try { System.Diagnostics.Process.Start(_selectedFile.Path); } catch (Exception) { _eventAggregator.GetEvent <StatusNotificationIssued>().Publish("File non trovato"); } }, () => _selectedFile != null); OpenReportCommand = new DelegateCommand( () => { NavigationToken token = new NavigationToken(Reports.ViewNames.ReportEditView, SelectedReport); _eventAggregator.GetEvent <NavigationRequested>().Publish(token); }, () => _selectedReport != null); RemoveControlPlanCommand = new DelegateCommand( () => { _selectedControlPlan.Delete(); RaisePropertyChanged("ControlPlanList"); SelectedControlPlan = null; }, () => CanEdit && _selectedControlPlan != null && !_selectedControlPlan.IsDefault); RemoveFileCommand = new DelegateCommand( () => { _selectedFile.Delete(); SelectedFile = null; }, () => Thread.CurrentPrincipal.IsInRole(UserRoleNames.SpecificationEdit) && _selectedFile != null); SaveCommand = new DelegateCommand( () => { _instance.Update(); _instance.Standard.Update(); EditMode = false; }, () => _editMode && !HasErrors); StartEditCommand = new DelegateCommand( () => { EditMode = true; }, () => Thread.CurrentPrincipal.IsInRole(UserRoleNames.SpecificationEdit) && !_editMode); // Event Subscriptions _eventAggregator.GetEvent <MethodChanged>() .Subscribe( tkn => { _methodVariantList = null; RaisePropertyChanged("MethodVariantList"); }); _eventAggregator.GetEvent <ReportCreated>().Subscribe( report => RaisePropertyChanged("ReportList")); }
public static List <PlanTrabajo> listaPlanes() { ControlPlan Plan = new ControlPlan(); return(Plan.ObtenerPlanes()); }
public static int TotalPlanes() { ControlPlan CP = new ControlPlan(); return(CP.ObtenerTotalPlanes()); }
protected int?ObtenerNodoPadre() { ControlPlan Plan = new ControlPlan(); return(Plan.ObtenerParteOrigenPLan(Interno)); }
public static List <PartePlan> ObtenerParteActividades() { ControlPlan Plan = new ControlPlan(); return(Plan.ObtenerParteActividades(Interno)); }
public static List <PartePlan> ObtenerParteActividades(string PLAN_Interno) { ControlPlan Plan = new ControlPlan(); return(Plan.ObtenerParteActividades(int.Parse(PLAN_Interno))); }
//int DataCount = 0; //List<Controlplan> DataStationDeviation = new List<Controlplan>(); protected override bool OnInit(object sender, EventArgs e) { //get TableMeta from Schema. Schema is loaded during login var schemaInfo = Application["SchemaInfo"] as SchemaInfo; tableMeta = schemaInfo.Tables.Where(s => s.Name.Equals(tableName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); if (tableMeta == null) { masterPage.MainContent.Controls.Add(new LiteralControl(string.Format("<h2>{0}</h2>", "Invalid Page"))); return(false); } //header info //int vpm = Request.QueryString["vpm"].ToInt32(0); //int modelId = Request.QueryString["model"].ToInt32(0); //int variantId = Request.QueryString["variant"].ToInt32(0); int cpId = Request.QueryString["CpId"].ToInt32(0); //int stationId = Request.QueryString["StationId"].ToInt32(0); //if (stationId == 0) // stationId = Request.QueryString["station"].ToInt32(0); using (AppDb ctx = new AppDb()) { if (cpId > 0) { cp = ctx.ControlPlans.Where(x => x.Id == cpId).FirstOrDefault(); } //else //{ // cp = ctx.ControlPlans.Where(x => x.ModelId == modelId && x.VariantId == variantId && x.PackingMonth == vpm.ToString()).FirstOrDefault(); //} } if (cp == null) { var panel1 = new System.Web.UI.WebControls.Panel(); panel1.CssClass = "mainContent"; panel1.Controls.Clear(); panel1.Controls.Add(new LiteralControl(string.Format("<h2 class='grid-header'>Invalid Model/Variant/PackingMonth for CP Station Detail</h2>"))); masterPage.MainContent.Controls.Clear(); masterPage.MainContent.Controls.Add(panel1); masterPage.PageTitle.Controls.Add(new LiteralControl(tableMeta.Caption)); return(false); } //else if (stationId == 0) //{ // var panel1 = new System.Web.UI.WebControls.Panel(); // panel1.CssClass = "mainContent"; // panel1.Controls.Clear(); // panel1.Controls.Add(new LiteralControl(string.Format("<h2 class='grid-header'>Invalid Station for CP Station Detail</h2>"))); // masterPage.MainContent.Controls.Clear(); // masterPage.MainContent.Controls.Add(panel1); // masterPage.PageTitle.Controls.Add(new LiteralControl(tableMeta.Caption)); // return false; //} //Set master key SetMasterKey("ControlPlanId", cp.Id); //Store the CP object so that it is accessible to other classes keyValues.Add("CP", cp); keyValues.Add("ControlPlanId", cp.Id); hfDocControl["PackingMonth"] = cp.PackingMonth; hfDocControl["ModelId"] = cp.AssemblyModelId; //create header string ModelName = ControlPlanRepository.RetrieveAssemblyModelNameById(cp.AssemblyModelId); //string StationName = ControlPlanRepository.RetrieveStationNameById(stationId); //lblStationName.Text = StationName; lblPackingMonth.Text = cp.PackingMonth; lblModel.Text = ModelName; //if (!IsPostBack && !IsCallback) //{ // if (Request.QueryString.Count > 0) // { // hfDocControl["ControlPlanId"] = cpId; // if (cp != null) // { // hfDocControl["PackingMonth"] = cp.PackingMonth; // hfDocControl["ModelId"] = cp.ModelId; // hfDocControl["VariantId"] = cp.VariantId; // lblPackingMonth.Text = cp.PackingMonth; // lblModel.Text = ModelRepository.RetrieveModelNameById(cp.ModelId) + " " + // ModelRepository.RetrieveVariantNameByModelIdAndVariantId( // cp.ModelId, cp.VariantId); // } // } //} //else //{ // if (Session["StationId"] != null) // { // if (popupDocControl.HeaderText.ToString() == "Document Control - Working Instruction") // { // grvDocControlDetail.DataSourceID = null; // grvDocControlDetail.DataSource = ControlPlanRepository.RetrieveDocumentByDocTypeAndStationId("CPWI", // Convert.ToInt32(Session["StationId"].ToString()), cp.PackingMonth, Convert.ToInt32(cp.ModelId), Convert.ToInt32(cp.VariantId)); // grvDocControlDetail.DataBind(); // } // else // { // grvDocControlDetail.DataSourceID = null; // grvDocControlDetail.DataSource = ControlPlanRepository.RetrieveDocumentByDocTypeAndStationIdII("CPII", // Convert.ToInt32(Session["StationId"].ToString()), cp.PackingMonth, Convert.ToInt32(cp.ModelId), Convert.ToInt32(cp.VariantId)); // grvDocControlDetail.DataBind(); // } // } //} return(true); }
public static bool CreateNewControlPlan(int packingMonth, int modelId, int variantId) { using (AppDb context = new AppDb()) { context.Database.CommandTimeout = 360; //in second using (DbContextTransaction transaction = context.Database.BeginTransaction()) { try { ControlPlan cpHeader = new ControlPlan(); cpHeader.PackingMonth = packingMonth.ToString(); cpHeader.ModelId = modelId; cpHeader.VariantId = variantId; context.ControlPlans.Add(cpHeader); context.SaveChanges(); ////save ke CPHeader //CPHeader cpHeader = new CPHeader(); //cpHeader.PackingMonthId = packingMonth; //cpHeader.ModelId = modelId; //cpHeader.VariantId = variantId; //context.CpHeaders.Add(cpHeader); //try //{ // context.SaveChanges(); //} //catch (DbEntityValidationException e) //{ // foreach (var eve in e.EntityValidationErrors) // { // AppLogger.LogError(@"Entity of type '" + eve.Entry.Entity.GetType().Name + "' in state '" + // eve.Entry.State + "' has the following validation errors:"); // foreach (var ve in eve.ValidationErrors) // { // AppLogger.LogError(string.Format("- Property: \"{0}\", Error: \"{1}\"", // ve.PropertyName, ve.ErrorMessage)); // } // } // throw; //} ////save to CPDetail //context.Database.ExecuteSqlCommand("usp_CreateControlPlanDetail @vpm, @model, @variant, @createdBy", // new SqlParameter("@vpm", packingMonth), new SqlParameter("@model", modelId), // new SqlParameter("@variant", variantId), new SqlParameter("@createdBy", "")); ////save ke Consumption material //context.Database.ExecuteSqlCommand("usp_CreateConsumptionMaterial @vpm, @model", // new SqlParameter("@vpm", packingMonth), new SqlParameter("@model", modelId)); ////save ke ToolList //context.Database.ExecuteSqlCommand("usp_CreateControlPlanToolList @vpm, @model", // new SqlParameter("@vpm", packingMonth), new SqlParameter("@model", modelId)); transaction.Commit(); return(true); } catch (Exception ex) { AppLogger.LogError(ex); transaction.Rollback(); } } } return(false); }