コード例 #1
0
        /*
        Metodo que se utiliza para actualizar la unidad
        */
        private void updateUnitAux()
        {
            if (HttpContext.Current.Session["UnitId"] != null)
            {
                string Name = UnitName.Text;
                string Symbol = UnitSymbol.Text;

                if (Name != "" & Symbol != "")
                {
                    ParameterService parameterService = new ParameterService();

                    String reason = Session["reason"].ToString();
                    String user = Context.User.Identity.Name;
                    AuditDataFromWeb audit = new AuditDataFromWeb();
                    audit.Reason = reason;
                    audit.StationIP = General.getIp(this.Page);
                    audit.UserName = user;

                    UnitView unit = new UnitView();
                    unit.UnitName = Name;
                    unit.UnitSymbol = Symbol;
                    unit.UnitId = Int32.Parse(HttpContext.Current.Session["UnitId"].ToString());
                    CUDView crud = parameterService.updateUnits(unit, audit);

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

                        fillUnitGroupTable();
                        updateUnitModal.Update();
                    }
                    HttpContext.Current.Session["operation"] = "create";
                    showUnitModal();
                }
            }
        }
コード例 #2
0
        protected void updateUnit_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["UnitId"] != null)
            {
                string Name = UnitName.Text;
                string Symbol = UnitSymbol.Text;

                if (Name != "" & Symbol != "")
                {
                    ParameterService parameterService = new ParameterService();

                    UnitView unit = new UnitView();
                    unit.UnitName = Name;
                    unit.UnitSymbol = Symbol;
                    unit.UnitId = Int32.Parse(HttpContext.Current.Session["UnitId"].ToString());
                    CUDView crud = parameterService.updateUnits(unit);

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

                        fillUnitGroupTable();
                        updateUnitModal.Update();
                    }
                }
            }
        }