/*Funcion: Obtiene una lista de las operaciones de una receta Param: idProcess Return: Lista RecipeOperationView */ public List<RecipeOperationView> getRecipeOperationForProcessUpn(int idProcess) { UpnDao Dao = new UpnDao(); DataTable DaoResult = Dao.getRecipeOperationForProcessUpn(idProcess); List<RecipeOperationView> ViewList = new List<RecipeOperationView>(); IndexLogic index = new IndexLogic(); foreach (DataRow row in DaoResult.Rows) { RecipeOperationView x = new RecipeOperationView(); if (DaoResult.Columns.Contains("OperationName") && row["OperationName"] != DBNull.Value) { x.OperationName = row["OperationName"].ToString(); } if (DaoResult.Columns.Contains("OperationId") && row["OperationId"] != DBNull.Value) { x.OperationId = Convert.ToInt32(row["OperationId"]); } x.Order = index.getIndex(); ViewList.Add(x); } return ViewList; }
/*Funcion: Obtiene una lista de operaciones por procesos Param: processId Return: Lista UpnOperationView */ public List<UpnOperationView> getUpnOperationbyProcess(int processId) { UpnDao Dao = new UpnDao(); DataTable DaoResult = Dao.getUpnOperationbyProcess(processId); List<UpnOperationView> ViewList = new List<UpnOperationView>(); IndexLogic index = new IndexLogic(); foreach (DataRow row in DaoResult.Rows) { UpnOperationView x = new UpnOperationView(); if (DaoResult.Columns.Contains("Operation") && row["Operation"] != DBNull.Value) { x.Operation = row["Operation"].ToString(); } if (DaoResult.Columns.Contains("Enable") && row["Enable"] != DBNull.Value) { x.Enable = (bool)row["Enable"]; } if (DaoResult.Columns.Contains("OperationId") && row["OperationId"] != DBNull.Value) { x.OperationId = (int)row["OperationId"]; } if (DaoResult.Columns.Contains("RecipeId") && row["RecipeId"] != DBNull.Value) { x.RecipeId = (int)row["RecipeId"]; } if (DaoResult.Columns.Contains("Recipe") && row["Recipe"] != DBNull.Value) { x.Recipe = row["Recipe"].ToString(); } x.Order = index.getIndex(); ViewList.Add(x); } return ViewList; }
/*Funcion: Obtiene una lista de todos los UPN Param: Return: Lista UpnView */ public List<UpnView> getUpn() { UpnDao Dao = new UpnDao(); DataTable DaoResult = Dao.getUpn(); return buildUpn(DaoResult); }
/*Funcion: Borra un upn Param: upnId Return: Status */ public CUDView deleteUpn(string upnId) { UpnDao Dao = new UpnDao(); String state = Dao.deleteUpn(upnId); return CUDVerifyLogic.verifierInsertDeleteUpdate("delete", state); }
/*Funcion: actualiza un Upn por operacion Param: upnUpdateView, AuditDataFromWeb Return: Status */ public CUDView updateUpnOperation(UpnOperationView upnUpdateView, AuditDataFromWeb audit) { CUDView logic = new CUDView(); AuditDao auditDao = new AuditDao(); DataTable auditDaoResult = auditDao.getUpnOperatoinOldValues(upnUpdateView.UpnId,upnUpdateView.ProcessId,upnUpdateView.OperationId); String OldValues = "UpnId: " + upnUpdateView.UpnId; foreach (DataRow row in auditDaoResult.Rows) { if (auditDaoResult.Columns.Contains("RecipeId") && row["RecipeId"] != DBNull.Value) { OldValues = OldValues + ", RecipeId: " + row["RecipeId"].ToString(); } if (auditDaoResult.Columns.Contains("Enable") && row["Enable"] != DBNull.Value) { OldValues = OldValues + ", Enable: " + row["Enable"].ToString(); } } UpnDao Dao = new UpnDao(); String state = Dao.updateUpnOperation(upnUpdateView); logic=CUDVerifyLogic.verifierInsertDeleteUpdate("update", state); if (logic.update == true) { AuditService auditservice = new AuditService(); String Action = "Update upnOperation"; String newValues = "UpnId: " + upnUpdateView.UpnId; newValues = newValues + ", RecipeId: " + upnUpdateView.RecipeId; newValues = newValues + ", Enable: " + upnUpdateView.Enable; auditservice.formUpdate(Action, newValues, OldValues, audit); } return logic; }
/*Funcion: actualiza un Upn Param: UpnUpdateView, AuditDataFromWeb Return: Status */ public CUDView updateUpn(UpnUpdateView upnUpdateView, AuditDataFromWeb audit) { CUDView logic = new CUDView(); AuditDao auditDao = new AuditDao(); DataTable auditDaoResult = auditDao.getUpnOldValues(upnUpdateView.UpnId); String OldValues = "UpnId: " + upnUpdateView.UpnId; foreach (DataRow row in auditDaoResult.Rows) { if (auditDaoResult.Columns.Contains("UPNStatus") && row["UPNStatus"] != DBNull.Value) { OldValues = OldValues + ", Enable: " + (bool)row["UPNStatus"]; } if (auditDaoResult.Columns.Contains("UpnMultipleSessions") && row["UpnMultipleSessions"] != DBNull.Value) { OldValues = OldValues + ", UpnMultipleSession: " + (bool)row["UpnMultipleSessions"]; } } UpnDao Dao = new UpnDao(); String state = Dao.updateUpn(upnUpdateView); logic = CUDVerifyLogic.verifierInsertDeleteUpdate("update", state); if (logic.update == true) { AuditService auditservice = new AuditService(); String Action = "Update Upn"; String NewValues = "UpnId: " + upnUpdateView.UpnId + ", Enable: " + upnUpdateView.UpnStatus + ", UpnMultipleSession: " + upnUpdateView.Multisession; auditservice.formUpdate(Action, NewValues, OldValues, audit); } return logic; }
/*Funcion: Busca un Upn segun los datos de busqueda ingresados Param: datos de busqueda Return: Lista UpnView */ public List<UpnView> searchUpn(String partial) { UpnDao Dao = new UpnDao(); DataTable DaoResult = Dao.searchUpn(partial); return buildUpn(DaoResult); }
/*Funcion: Inserta una operacion Upn Param: UpnInsertOperationView, AuditDataFromWeb Return: Lista UpnOperationView */ public CUDView insertUpnOperation(UpnInsertOperationView upnOperationView, AuditDataFromWeb audit) { UpnDao Dao = new UpnDao(); String state = Dao.insertUpnOperation(upnOperationView); CUDView logic = CUDVerifyLogic.verifierInsertDeleteUpdate("insert", state); if (logic.insert == true) { AuditService auditservice = new AuditService(); String Action = "Insert new upn operation"; String NewValues = "UpnId: " + upnOperationView.UpnId + ", RecipeId: " + upnOperationView.RecipeId + ", ProcessId: " + upnOperationView.ProcessId + ", OperationId: " + upnOperationView.OperationId + ", OperationEnable: " + upnOperationView.OperationEnable; auditservice.formInsert(Action, NewValues, audit); } return logic; }
/*Funcion: Inserta un Upn Param: upnInsertView, AuditDataFromWeb Return: status */ public CUDView insertUpn(UpnInsertView upnInsertView, AuditDataFromWeb audit) { UpnDao Dao = new UpnDao(); String state = Dao.insertUpn(upnInsertView); CUDView logic = CUDVerifyLogic.verifierInsertDeleteUpdate("insert", state); if (logic.insert == true) { AuditService auditservice = new AuditService(); String Action = "Insert new UPN"; String NewValues = "UpnId: " + upnInsertView.UpnId + ", ProductLineId: " + upnInsertView.ProductLineId + ", UPNStatus: " + upnInsertView.UPNStatus + ", UpnTypeId: " + upnInsertView.UpnTypeId + ", UpnMultipleSession: " + upnInsertView.Multisession; auditservice.formInsert(Action, NewValues, audit); } return logic; }