/*Funcion: Construir el objeto EquipmentOperation a partir del DAO Param: DaoResult Return: Lista OperationEquipment */ public List<OperationEquipmentView> buildEquipmentOperation(DataTable DaoResult) { List<OperationEquipmentView> ViewList = new List<OperationEquipmentView>(); IndexLogic index = new IndexLogic(); foreach (DataRow row in DaoResult.Rows) { OperationEquipmentView x = new OperationEquipmentView(); if (DaoResult.Columns.Contains("EquipmentName") && row["EquipmentName"] != DBNull.Value) { x.GroupName = row["EquipmentName"].ToString(); } if (DaoResult.Columns.Contains("ID") && row["ID"] != DBNull.Value) { x.EquipmentId =row["ID"].ToString(); } if (DaoResult.Columns.Contains("GroupId") && row["GroupId"] != DBNull.Value) { x.GroupId = Convert.ToInt32(row["GroupId"]); } x.ID = index.getIndex(); ViewList.Add(x); } return ViewList; }
/*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; }