Exemplo n.º 1
0
 protected void btnInsert_Click(object sender, EventArgs e)
 {
     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "function", "<script>reallowOp();</script>", false);
     try
     {
         string error = string.Empty;
         if (string.IsNullOrEmpty(this.TxtDescObject.Text.Trim()))
         {
             error = "WarningDescriptionProjectNotEmpty";
             ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectLength", "parent.ajaxDialogModal('" + error + "', 'warning');", true);
             return;
         }
         if (string.IsNullOrEmpty(this.DdlRegRf.SelectedItem.Value))
         {
             error = "ErrorRegisterNotSelected";
             ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorRegisterNotSelected", "parent.ajaxDialogModal('" + error + "', 'warning');", true);
             return;
         }
         Registro reg = (from r in RegistryManager.GetRegAndRFListInSession()
                         where r.systemId.Equals(this.DdlRegRf.SelectedValue)
                         select r).FirstOrDefault();
         if (reg != null)
         {
             if (reg.chaRF.Equals("0"))
             {
                 error = "WarningDescriptionProjectInsertReg";
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorRegisterNotSelected", "parent.ajaxDialogModal('" + error + "', 'warning');", true);
                 return;
             }
             DescrizioneFascicolo descFasc = new DescrizioneFascicolo();
             descFasc.Descrizione = this.TxtDescObject.Text;
             descFasc.Codice      = this.TxtCodObject.Text;
             descFasc.IdRegistro  = reg.systemId;
             descFasc.IdAmm       = UserManager.GetInfoUser().idAmministrazione;
             ResultDescrizioniFascicolo resultInsDescFasc = ResultDescrizioniFascicolo.OK;
             bool result = ProjectManager.InsertDescrizioneFascicolo(descFasc, out resultInsDescFasc);
             if (!result)
             {
                 error = GetErrorMessage(resultInsDescFasc);
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectLength", "parent.ajaxDialogModal('" + error + "', 'warning');", true);
                 return;
             }
             this.SelectedPage         = 0;
             this.grid_pageindex.Value = string.Empty;
             this.grid_rowindex.Value  = "0";
             this.Filtro = this.BindFilter();
             List <DescrizioneFascicolo> descriptionList = this.SearchDescriptionProject();
             BindGridDescriptionProject(descriptionList);
         }
     }
     catch (System.Exception ex)
     {
         UIManager.AdministrationManager.DiagnosticError(ex);
     }
 }
Exemplo n.º 2
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "function", "<script>reallowOp();</script>", false);
            try
            {
                DescrizioneFascicolo descFasc = new DescrizioneFascicolo();
                descFasc.SystemId    = (GridDescriptionProject.Rows[this.GridDescriptionProject.SelectedIndex].FindControl("lblSystemid") as Label).Text;
                descFasc.Codice      = this.TxtCodObject.Text;
                descFasc.Descrizione = this.TxtDescObject.Text;

                this.DescrizioneFascicoloSelezionata = descFasc;
                ScriptManager.RegisterClientScriptBlock(this.UpPnlButtons, this.UpPnlButtons.GetType(), "closeAJM", "parent.closeAjaxModal('DescriptionProjectList','up');", true);
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
            }
        }
Exemplo n.º 3
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "function", "<script>reallowOp();</script>", false);
            try
            {
                string error = string.Empty;
                if (string.IsNullOrEmpty(this.TxtDescObject.Text.Trim()))
                {
                    error = "WarningDescriptionProjectNotEmpty";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectLength", "parent.ajaxDialogModal('" + error + "', 'warning');", true);
                    return;
                }
                DescrizioneFascicolo descFasc = new DescrizioneFascicolo();
                descFasc.SystemId    = (GridDescriptionProject.Rows[this.GridDescriptionProject.SelectedIndex].FindControl("lblSystemid") as Label).Text;
                descFasc.Codice      = this.TxtCodObject.Text;
                descFasc.Descrizione = this.TxtDescObject.Text;
                descFasc.IdRegistro  = (GridDescriptionProject.Rows[this.GridDescriptionProject.SelectedIndex].FindControl("lblIdRegistro") as Label).Text;
                descFasc.IdAmm       = (GridDescriptionProject.Rows[this.GridDescriptionProject.SelectedIndex].FindControl("lblIdAmm") as Label).Text;

                ResultDescrizioniFascicolo resultUpdateDescFasc = ResultDescrizioniFascicolo.OK;
                if (!ProjectManager.AggiornaDescrizioneFascicolo(descFasc, out resultUpdateDescFasc))
                {
                    error = GetErrorMessage(resultUpdateDescFasc);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectLength", "parent.ajaxDialogModal('" + error + "', 'warning');", true);
                    return;
                }

                (GridDescriptionProject.Rows[this.GridDescriptionProject.SelectedIndex].FindControl("lblCodObject") as Label).Text  = descFasc.Codice;
                (GridDescriptionProject.Rows[this.GridDescriptionProject.SelectedIndex].FindControl("lblDescObject") as Label).Text = descFasc.Descrizione;
                this.UpdPnlGridDescriptionProject.Update();
                this.grid_rowindex.Value = string.Empty;
                this.HighlightSelectedRow();
                EnableButton();
                this.TxtCodObject.Text  = string.Empty;
                this.TxtDescObject.Text = string.Empty;
                this.UpdPnlCodeObject.Update();
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
            }
        }