Пример #1
0
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     AgencyManager mgr = new AgencyManager();
     Agency obj = new Agency();
     obj.Agency_ID = (GridView1.SelectedDataKey).Value.ToString();
     obj = mgr.selectAgency(obj);
     AddEditAgencyControl1.populateControls(obj);
     MultiView1.ActiveViewIndex = 1;
 }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         AgencyManager mgr = new AgencyManager();
         Agency obj = new Agency();
         obj.Agency_ID = txtID.Text.Trim();
         lblError.Text = CustomErrors.CHANGES_ACCEDTED_STATUS + mgr.deleteAgency(obj);
         ClearControls();
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
    protected void btnOpt_Click(object sender, EventArgs e)
    {
        try
        {
            Agency obj = CaptureData();

            AgencyManager mgr = new AgencyManager();

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