Ejemplo n.º 1
0
        /*Funcion: obtener parametros por procesos
          Param: processID
          Return: Lista ParameterProcessView
          */
        public List<ParameterProcessView> getParameterByProcess(String processID)
        {
            ParameterDao Dao = new ParameterDao();
            DataTable DaoResult = Dao.getParameterByProcess(processID);
            List<ParameterProcessView> ViewList = new List<ParameterProcessView>();

            foreach (DataRow row in DaoResult.Rows)
            {
                ParameterProcessView x = new ParameterProcessView();
                if (DaoResult.Columns.Contains("ParameterId") && row["ParameterId"] != DBNull.Value) { x.ParameterId = Convert.ToInt32(row["ParameterId"]); }
                if (DaoResult.Columns.Contains("ParameterYPlotRange") && row["ParameterYPlotRange"] != DBNull.Value) { x.ParameterYPlotRange = Convert.ToInt32(row["ParameterYPlotRange"]); }
                if (DaoResult.Columns.Contains("Parameter") && row["Parameter"] != DBNull.Value) { x.Parameter = row["Parameter"].ToString(); }
                if (DaoResult.Columns.Contains("Unit") && row["Unit"] != DBNull.Value) { x.Unit = row["Unit"].ToString(); }

                if (DaoResult.Columns.Contains("ParameterXPlot") && row["ParameterXPlot"] != DBNull.Value) { x.ParameterXPlot = (bool)row["ParameterXPlot"]; }
                if (DaoResult.Columns.Contains("ParameterYPlot") && row["ParameterYPlot"] != DBNull.Value) { x.ParameterYPlot = (bool)row["ParameterYPlot"]; }
                if (DaoResult.Columns.Contains("Value") && row["Value"] != DBNull.Value) { x.Value = Convert.ToDouble(row["Value"]); }

                ViewList.Add(x);
            }
            return ViewList;
        }
Ejemplo n.º 2
0
 /*Funcion: obtener lista parametros
   Param:
   Return: status
   */
 public List<ParameterView> getParameter()
 {
     ParameterDao Dao = new ParameterDao();
     DataTable DaoResult = Dao.getParameter();
     return buildParameter(DaoResult);
 }
Ejemplo n.º 3
0
        /*Funcion: actualizar parametros
          Param: ParameterUpdateView,AuditDataFromWeb
          Return: status
          */
        public CUDView updateParameter(ParameterUpdateView parameter, AuditDataFromWeb audit)
        {
            AuditDao auditDao = new AuditDao();
            DataTable auditDaoResult = auditDao.getParameterByParameterID(parameter.ParameterId);
            String OldValues = "ParameterId: " + parameter.ParameterId;

            foreach (DataRow row in auditDaoResult.Rows)
            {
                if (auditDaoResult.Columns.Contains("ParameterMinValue") && row["ParameterMinValue"] != DBNull.Value) { OldValues = OldValues + ", ParameterMinValue: " + Convert.ToDouble(row["ParameterMinValue"]); }
                if (auditDaoResult.Columns.Contains("ParameterName") && row["ParameterName"] != DBNull.Value) { OldValues = OldValues + ", ParameterName: " + row["ParameterName"].ToString(); }
                if (auditDaoResult.Columns.Contains("ParameterXPlot") && row["ParameterXPlot"] != DBNull.Value) { OldValues = OldValues + ", ParameterXPlot: " + (bool)row["ParameterXPlot"]; }
                if (auditDaoResult.Columns.Contains("ParameterYPlot") && row["ParameterYPlot"] != DBNull.Value) { OldValues = OldValues + ", ParameterYPlot: " + (bool)row["ParameterYPlot"]; }
                if (auditDaoResult.Columns.Contains("ParameterYPlotRange") && row["ParameterYPlotRange"] != DBNull.Value) { OldValues = OldValues + ", ParameterYPlotRange: " + Convert.ToInt32(row["ParameterYPlotRange"]); }
                if (auditDaoResult.Columns.Contains("ProcessId") && row["ProcessId"] != DBNull.Value) { OldValues = OldValues + ", ProcessId: " + Convert.ToInt32(row["ProcessId"]); }
                if (auditDaoResult.Columns.Contains("UnitId") && row["UnitId"] != DBNull.Value) { OldValues = OldValues + ", UnitId: " + row["UnitId"].ToString(); }

            }

            ParameterDao Dao = new ParameterDao();
            String state = Dao.updateParameter(parameter);
            CUDView logic = CUDVerifyLogic.verifierInsertDeleteUpdate("update", state);

            if (logic.update == true)
            {
                AuditService auditservice = new AuditService();
                String Action = "Update parameter";
                String NewValues = "ParameterId: " + parameter.ParameterId
                    + ", ParameterMinValue: " + parameter.ParameterMinValue
                    + ", ParameterName: " + parameter.ParameterName
                    + ", ParameterXPlot: " + parameter.ParameterXPlot
                    + ", ParameterYPlot: " + parameter.ParameterYPlot
                    + ", ParameterYPlotRange: " + parameter.ParameterYPlotRange
                    + ", ProcessId: " + parameter.ProcessId
                    + ", UnitId: " + parameter.UnitId;
                auditservice.formUpdate(Action, NewValues, OldValues, audit);
            }

            return logic;
        }
Ejemplo n.º 4
0
        /*Funcion: Actualizar Units
          Param: UnitView,AuditDataFromWeb
          Return: Status
          */
        public CUDView updateUnits(UnitView unit, AuditDataFromWeb audit)
        {
            AuditDao auditDao = new AuditDao();
            DataTable auditDaoResult = auditDao.getUnitByUnitId(unit.UnitId);
            String OldValues = "UnitId: " + unit.UnitId;

            foreach (DataRow row in auditDaoResult.Rows)
            {
                if (auditDaoResult.Columns.Contains("UnitName") && row["UnitName"] != DBNull.Value) { OldValues = OldValues + ", UnitName: " + row["UnitName"].ToString(); }
                if (auditDaoResult.Columns.Contains("UnitSymbol") && row["UnitSymbol"] != DBNull.Value) { OldValues = OldValues + ", UnitSymbol: " + row["UnitSymbol"].ToString(); }

            }

            ParameterDao Dao = new ParameterDao();
            String state = Dao.updateUnits(unit);
            CUDView logic = CUDVerifyLogic.verifierInsertDeleteUpdate("update", state);

            if (logic.update == true)
            {
                AuditService auditservice = new AuditService();
                String Action = "Update unit";
                String NewValues = "UnitId: " + unit.UnitId
                    + ", UnitName: " + unit.UnitName
                    + ", UnitSymbol: " + unit.UnitSymbol;

                auditservice.formUpdate(Action, NewValues, OldValues, audit);
            }

            return logic;
        }
Ejemplo n.º 5
0
        /*Funcion: Insertar Units
          Param: UnitsInsertView,AuditDataFromWeb
          Return: Lista Units
          */
        public CUDView insertUnits(UnitsInsertView unit, AuditDataFromWeb audit)
        {
            ParameterDao Dao = new ParameterDao();
            String state = Dao.insertUnits(unit);
            CUDView logic = CUDVerifyLogic.verifierInsertDeleteUpdate("insert", state);

            if (logic.insert == true)
            {
                AuditService auditservice = new AuditService();
                String Action = "Insert new unit";
                String NewValues = "UnitName: " + unit.UnitName
                    + ", UnitSymbol: " + unit.UnitSymbol;

                auditservice.formInsert(Action, NewValues, audit);
            }
            return logic;
        }
Ejemplo n.º 6
0
 /*Funcion: Buscar procesos por datos parciales
   Param: datos parceales
   Return: Lista ParameterView
   */
 public List<ParameterView> searchProcess(String partial)
 {
     ParameterDao Dao = new ParameterDao();
     DataTable DaoResult = Dao.searchParameter(partial);
     return buildParameter(DaoResult);
 }
Ejemplo n.º 7
0
        /*Funcion: insertar parametros
          Param: ParameterInsertView,AuditDataFromWeb
          Return: status
          */
        public CUDView insertParameter(ParameterInsertView parameter, AuditDataFromWeb audit)
        {
            ParameterDao Dao = new ParameterDao();
            String state = Dao.insertParameter(parameter);
            CUDView logic = CUDVerifyLogic.verifierInsertDeleteUpdate("insert", state);

            if (logic.insert == true)
            {
                AuditService auditservice = new AuditService();
                String Action = "Insert new parameter";
                String NewValues = "ParameterName: " + parameter.ParameterName
                    + ", ParameterMinValue: " + parameter.ParameterMinValue
                    + ", ParameterXPlot: " + parameter.ParameterXPlot
                    + ", ParameterYPlot: " + parameter.ParameterYPlot
                    + ", ParameterYPlotRange: " + parameter.ParameterYPlotRange
                    + ", ProcessId: " + parameter.ProcessId
                    + ", UnitId: " + parameter.UnitId;

                auditservice.formInsert(Action, NewValues, audit);
            }
            return logic;
        }
Ejemplo n.º 8
0
        /*Funcion: busca si existe el proceso para ese parametro
          Param: processID
          Return: bool
          */
        public bool hadProcessParameter(String processID)
        {
            ParameterDao Dao = new ParameterDao();
            DataTable DaoResult = Dao.hadProcessParameter(processID);

            bool state = false;

            foreach (DataRow row in DaoResult.Rows)
            {
                RecipeProcessView x = new RecipeProcessView();
                if (DaoResult.Columns.Contains("Result") && row["Result"] != DBNull.Value) { state = (bool) row["Result"]; }

            }
            return state;
        }
Ejemplo n.º 9
0
 //Exec getParameterByProcessAndProduct @ProcessId =1 , @ProductId =1
 /*Funcion: Obtener las unidades
   Param:
   Return: Lista UnitView
   */
 public List<UnitView> getUnits()
 {
     ParameterDao Dao = new ParameterDao();
     DataTable DaoResult = Dao.getUnits();
     return buildUnits(DaoResult);
 }
Ejemplo n.º 10
0
        /*Funcion: Obtener unidad para un parametro
          Param: ParameterId
          Return: Unit
          */
        public UnitView getUnitFromParameter(int ParameterId )
        {
            ParameterDao Dao = new ParameterDao();
            DataTable DaoResult = Dao.getUnitFromParameter(ParameterId);
            UnitView View = new UnitView();

            foreach (DataRow row in DaoResult.Rows)
            {

                if (DaoResult.Columns.Contains("UnitId") && row["UnitId"] != DBNull.Value) { View.UnitId = Convert.ToInt32(row["UnitId"]); }
                if (DaoResult.Columns.Contains("UnitName") && row["UnitName"] != DBNull.Value) { View.UnitName = row["UnitName"].ToString(); }
                if (DaoResult.Columns.Contains("UnitSymbol") && row["UnitSymbol"] != DBNull.Value) { View.UnitSymbol = row["UnitSymbol"].ToString(); }

            }
            return View;
        }
Ejemplo n.º 11
0
        /*Funcion: Obtiene los parametros de un proceso y producto
          Param: ProcessProductView
          Return: Lista Paramatros
          */
        public List<ParameterUnitView> getParameterByProcessAndProduct(ProcessProductView view)
        {
            ParameterDao Dao = new ParameterDao();
            DataTable DaoResult = Dao.getParameterByProcessAndProduct(view);
            List<ParameterUnitView> ViewList = new List<ParameterUnitView>();

            foreach (DataRow row in DaoResult.Rows)
            {
                ParameterUnitView x = new ParameterUnitView();
                if (DaoResult.Columns.Contains("UnitId") && row["UnitId"] != DBNull.Value) { x.UnitId = Convert.ToInt32(row["UnitId"]); }
                if (DaoResult.Columns.Contains("Parameter") && row["Parameter"] != DBNull.Value) { x.Parameter = row["Parameter"].ToString(); }
                if (DaoResult.Columns.Contains("Unit") && row["Unit"] != DBNull.Value) { x.Unit = row["Unit"].ToString(); }
                ViewList.Add(x);
            }
            return ViewList;
        }