protected void addUnit_Click(object sender, EventArgs e)
        {
            string Name = UnitName.Text;
            string Symbol = UnitSymbol.Text;

            if (Name != "" & Symbol != "")
            {
                ParameterService parameterService = new ParameterService();
                UnitsInsertView unit = new UnitsInsertView();
                unit.UnitName = Name;
                unit.UnitSymbol = Symbol;

                CUDView crud = parameterService.insertUnits(unit);

                if (crud.insert == false)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the Value')", true);
                }
                else
                {
                    UnitName.Text = "";
                    UnitSymbol.Text = "";

                    fillUnitGroupTable();
                    updateUnitModal.Update();
                }

            }
        }
        /*
        Metodo que inserta las unidades desde la ventana de add units
        */
        protected void addUnit_Click(object sender, EventArgs e)
        {
            string Name = UnitName.Text;
            string Symbol = UnitSymbol.Text;

            if (Name != "" & Symbol != "")
            {
                ParameterService parameterService = new ParameterService();
                UnitsInsertView unit = new UnitsInsertView();
                unit.UnitName = Name;
                unit.UnitSymbol = Symbol;

                String user = Context.User.Identity.Name;
                AuditDataFromWeb audit = new AuditDataFromWeb();
                audit.Reason = "N/A";
                audit.StationIP = General.getIp(this.Page);
                audit.UserName = user;

                CUDView crud = parameterService.insertUnits(unit, audit);

                if (crud.insert == false)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the Value')", true);
                }
                else
                {
                    UnitName.Text = "";
                    UnitSymbol.Text = "";

                    fillUnitGroupTable();
                    updateUnitModal.Update();
                }

            }
        }
        /*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;
        }
Esempio n. 4
0
 /*
   Funcion: Inserta Unidades
   Param: UnitName, UnitSymbol
   Return: Status
   */
 public String insertUnits(UnitsInsertView unit)
 {
     return context.InsertUpdateDeleteMSQL("EXEC insertUnits @UnitName='" + unit.UnitName + "', @UnitSymbol='" + unit.UnitSymbol + "'");
 }