Пример #1
0
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     AgreementManager mgr = new AgreementManager();
     Agreement obj = new Agreement();
     obj.Agreement_ID = (GridView1.SelectedDataKey).Value.ToString();
     obj = mgr.selectAgreement(obj);
     AddEditAgreementControl1.populateControls(obj);
     MultiView1.ActiveViewIndex = 1;
 }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         AgreementManager mgr = new AgreementManager();
         Agreement obj = new Agreement();
         obj.Agreement_ID = txtID.Text.Trim();
         lblError.Text = CustomErrors.CHANGES_ACCEDTED_STATUS + mgr.deleteAgreement(obj);
         ClearControls();
     }
     catch(Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
    protected void btnOpt_Click(object sender, EventArgs e)
    {
        try
        {
            Agreement obj = this.CaptureData();

            AgreementManager mgr = new AgreementManager();

            if ((string)Session["Flag"] == "New")
            {
                lblError.Text = CustomErrors.CHANGES_ACCEDTED_STATUS + mgr.insertAgreement(obj);
                ClearControls();
            }
            else
            {
                lblError.Text = CustomErrors.CHANGES_ACCEDTED_STATUS + mgr.updateAgreement(obj);
            }
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }