protected void btnAgentAdd_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         this._currentAgent = new AgentDL();
         bool bl = this.txtAgentID.Text.ToString() == "0";
         this._currentAgent.AddEditOption    = !bl ? 1 : 0;
         this._currentAgent.AgentID          = Convert.ToInt32(this.txtAgentID.Text.ToString());
         this._currentAgent.AgentDescription = this.txtAgent.Text.ToString();
         this._currentAgent.ScreenMode       = ScreenMode.Add;
         TransactionResult transactionResult = this._currentAgent.Commit();
         StringBuilder     stringBuilder     = new StringBuilder();
         stringBuilder.Append(string.Concat("<script>alert(\'", transactionResult.Message.ToString(), ".\');"));
         stringBuilder.Append("</script>");
         ScriptManager.RegisterStartupScript(base.Page, typeof(string), "MyScript", stringBuilder.ToString(), false);
         bl = transactionResult.Status != TransactionStatus.Success;
         if (!bl)
         {
             GetAgentDetails();
             this.txtAgent.Text   = "";
             this.txtAgentID.Text = "0";
         }
         else
         {
             this.txtAgent.Text   = "";
             this.txtAgentID.Text = "0";
         }
     }
     catch (Exception exception1)
     {
         ErrorLog.LogErrorMessageToDB("ManageAgent.aspx", "", "btnAgentAdd_Click", exception1.Message.ToString(), new ACEConnection());
         throw;
     }
 }
        private void LoadProductTypeDropDown()
        {
            try
            {
                CommonDL cl = new CommonDL();

                ddlBank.Items.Clear();
                ddlBank.DataSource     = cl.GetBankList().Tables[0];
                ddlBank.DataTextField  = "BankName";
                ddlBank.DataValueField = "BankID";
                ddlBank.DataBind();
                ddlBank.Items.Insert(0, "-- Select One --");
                ddlBank.Items[0].Value = "";

                AgentDL agentOBJ = new AgentDL();
                ddlAgentName.Items.Clear();
                ddlAgentName.DataSource     = agentOBJ.GetAgentList().Tables[0];
                ddlAgentName.DataTextField  = "AgentName";
                ddlAgentName.DataValueField = "AgentID";
                ddlAgentName.DataBind();
                ddlAgentName.Items.Insert(0, "-- Select One --");
                ddlAgentName.Items[0].Value = "";
            }
            catch (Exception exception1)
            {
                ErrorLog.LogErrorMessageToDB("AddEditSupplier.aspx", "", "LoadCityDropDown", exception1.Message.ToString(), new ACEConnection());
                throw;
            }
        }
 protected void gvAgent_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         this._currentAgent            = new AgentDL();
         this._currentAgent.AgentID    = Convert.ToInt32(this.gvAgent.DataKeys[e.RowIndex].Value);
         this._currentAgent.ScreenMode = ScreenMode.Delete;
         TransactionResult transactionResult = this._currentAgent.Commit();
         StringBuilder     stringBuilder     = new StringBuilder();
         stringBuilder.Append(string.Concat("<script>alert(\'", transactionResult.Message.ToString(), ".\');"));
         stringBuilder.Append("</script>");
         ScriptManager.RegisterStartupScript(base.Page, typeof(string), "MyScript", stringBuilder.ToString(), false);
         if (transactionResult.Status == TransactionStatus.Success)
         {
             GetAgentDetails();
         }
     }
     catch (Exception exception1)
     {
         ErrorLog.LogErrorMessageToDB("ManageAgent.aspx", "", "gvAgent_RowDeleting", exception1.Message.ToString(), new ACEConnection());
         throw;
     }
 }