Beispiel #1
0
        public void UserNameExist(string suario, string searchType, string accName)
        {
            DataTable accNameTable = new DataTable();
            string    nameInUse    = "0";

            Rep_Account accountSearch = new Rep_Account();

            //DataTable User = (DataTable)Session["user"];
            //userId = "4";
            accName      = Regex.Replace(accName, "[ ]{2,}", " ");
            accNameTable = accountSearch.SelectSearch(int.Parse(suario), searchType, accName, "AccountSearch");

            if (accNameTable.Rows.Count > 0)
            {
                nameInUse = accNameTable.Rows[0]["AccID"].ToString();
            }
            else
            {
                nameInUse = "0";
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.Write(js.Serialize(nameInUse));
        }
        private DataTable SelectContacts()
        {
            DataTable contactsDt = new DataTable();

            try
            {
                Rep_Account accountSearch = new Rep_Account();
                Rep_General general       = new Rep_General();

                DataTable User   = (DataTable)Session["user"];
                string    userId = User.Rows[0]["UserID"].ToString();
                string    accId  = "";

                if (Request.QueryString[general.ObfuscateQueryString("accID")] != null)
                {
                    string value = Request.QueryString[general.ObfuscateQueryString("accID")].ToString();
                    accId = general.DecryptIds(int.Parse(value)).ToString();
                }

                contactsDt = accountSearch.SelectContactSearch(int.Parse(userId), accId);
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "Error occurred please try again ";
                AlertMSG += errText;
                this.ClientScript.RegisterStartupScript(this.GetType(), this.GetType().Name,
                                                        string.Format("window.alert('{0}');", AlertMSG), true);
            }

            return(contactsDt);
        }
        private DataTable SelectddlDataTable(string proceduer, string param)
        {
            DataTable ddlTable = new DataTable();

            try
            {
                Rep_Account accountCrdtDdlsDetails = new Rep_Account();
                DataTable   User   = (DataTable)Session["user"];
                string      userId = User.Rows[0]["UserID"].ToString();

                ddlTable = accountCrdtDdlsDetails.SelectddlDataTable(int.Parse(userId), proceduer, param);
            }
            catch (Exception ex)
            {
                string Error    = ex.Message;
                string AlertMSG = "";
                AlertMSG += Error;
                this.ClientScript.RegisterStartupScript(this.GetType(), this.GetType().Name,
                                                        string.Format("window.alert('{0}');", AlertMSG), true);

                return(ddlTable);
            }

            return(ddlTable);
        }
Beispiel #4
0
        protected void lbSave_Service_OnClick(object sender, EventArgs e)
        {
            try
            {
                Rep_Account accServiceSave = new Rep_Account();
                DataTable   user           = (DataTable)Session["user"];

                int    userId  = int.Parse(user.Rows[0]["UserID"].ToString());
                string accId   = AccIDDec.Value;
                float  service = float.Parse(txtService_2.Text);

                accServiceSave.Acc_Service_Save(userId, accId, service);
                txtService_2.Text = string.Empty;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", "Saved"), true);
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += errText;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
Beispiel #5
0
        protected void btnSaveCurrency_OnClick(object sender, EventArgs e)
        {
            try
            {
                Rep_Account accCurrencySave   = new Rep_Account();
                DataTable   user              = (DataTable)Session["user"];
                DataTable   currencyDataTable = new DataTable();

                int    userId   = int.Parse(user.Rows[0]["UserID"].ToString());
                string currency = txtCurrency.Text.Replace(" ", string.Empty);

                currencyDataTable = DDLsData("SP_SysCode_All_Currency");

                string find = "Currency='" + currency + "'";

                DataRow[] foundRows = currencyDataTable.Select(find);
                if (foundRows.Length != 0)
                {
                    //currency is exist
                    lblCurrencyMsg.Text = "* This currency isn't allowed. Try again";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("ShowcurrencyDialog();"), true);
                }
                else
                {
                    lblCurrencyMsg.Text = "";
                    accCurrencySave.Acc_Currency_Save(userId, currency);
                    txtCurrency.Text = string.Empty;

                    dllCurrency.DataSource     = DDLsData("SP_SysCode_All_Currency");
                    dllCurrency.DataTextField  = "Currency";
                    dllCurrency.DataValueField = "CurrencyID";
                    dllCurrency.DataBind();
                    dllCurrency.Items.Insert(0, new ListItem("Select Currency", "-1"));
                }
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += errText;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
        protected void btnSaveCat2_OnClick(object sender, EventArgs e)
        {
            try
            {
                Rep_Account crdtCategorySave = new Rep_Account();
                DataTable   user             = (DataTable)Session["user"];
                DataTable   categoryDT       = new DataTable();

                int    userId       = int.Parse(user.Rows[0]["UserID"].ToString());
                string crdtCategory = txtAddCategory2.Text.Replace(" ", string.Empty);

                categoryDT = SelectddlDataTable("SP_SysCode_AccCrdt_Category2", "");

                string find = "Category='" + crdtCategory + "'";
                //myDataTable.Select("columnName1 like '%" + value + "%'");
                DataRow[] foundRows = categoryDT.Select(find);
                if (foundRows.Length != 0)
                {
                    //Category is exist
                    lblCat2Msg.Text = "* This Category isn't allowed. Try again";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("ShowCat_2_Dialog();"), true);
                }
                else
                {
                    lblCat2Msg.Text = "";
                    crdtCategorySave.Crdt_Category2_Save(userId, crdtCategory);
                    txtAddCategory2.Text = string.Empty;
                }

                dllCategory_2.DataSource     = SelectddlDataTable("SP_SysCode_AccCrdt_Category2", "");
                dllCategory_2.DataValueField = "CategoryID";
                dllCategory_2.DataTextField  = "Category";
                dllCategory_2.DataBind();
                dllCategory_2.Items.Insert(0, new ListItem("- Select -", "0"));
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += errText;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
        private void Select_Account_Crdt()
        {
            try
            {
                DataTable   User    = (DataTable)Session["user"];
                Rep_General general = new Rep_General();

                string      userId      = User.Rows[0]["UserID"].ToString();
                string      accId       = Request.QueryString[general.ObfuscateQueryString("accID")].ToString();
                int         id          = general.DecryptIds(int.Parse(accId));
                Rep_Account accountCrdt = new Rep_Account();

                DataTable accCrdtTable = accountCrdt.SelectCrdt(int.Parse(userId), id);

                if (accCrdtTable.Rows.Count > 0)
                {
                    txtCrdtNo.Text      = accCrdtTable.Rows[0]["AccCrdtNo"].ToString();
                    dllCategory_1.Text  = accCrdtTable.Rows[0]["AccCrdtGategory1"].ToString();
                    dllCategory_2.Text  = accCrdtTable.Rows[0]["AccCrdtGategory2"].ToString();
                    dllResponsible.Text = accCrdtTable.Rows[0]["AccCrdtResp"].ToString();
                    dllType.Text        = accCrdtTable.Rows[0]["AccCrdtType"].ToString();
                    txtMax.Text         = accCrdtTable.Rows[0]["AccCrdtMax"].ToString();
                    txtExtra.Text       = accCrdtTable.Rows[0]["AccCrdtExtra"].ToString();
                    txtMemo.InnerText   = accCrdtTable.Rows[0]["AccCrdtMemo"].ToString();
                    RBLBlocked.Text     = accCrdtTable.Rows[0]["AccCrdtStop"].ToString() == "True" ? "1" : "2";
                    //RBLBlocked.Items.FindByText(accCrdTable.Rows[0]["AccCrdtStop"].ToString()).Selected = true;
                }
                else
                {
                }

                string texttaccNo = Request.QueryString[general.ObfuscateQueryString("accNo")] != null ? Request.QueryString[general.ObfuscateQueryString("accNo")].ToString() : "";
                accNo.Text = texttaccNo != string.Empty ? general.DecryptIds(int.Parse(texttaccNo)).ToString() : "";
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += errText;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
        private void Select_Account_Name()
        {
            try
            {
                Rep_General general = new Rep_General();
                DataTable   User    = (DataTable)Session["user"];

                string userId = User.Rows[0]["UserID"].ToString();
                string accId  = "";
                if (Request.QueryString[general.ObfuscateQueryString("accID")] != null)
                {
                    string value = Request.QueryString[general.ObfuscateQueryString("accID")].ToString();
                    accId = general.DecryptIds(int.Parse(value)).ToString();
                }
                else
                {
                    //accId = lblAccID.Text;
                }


                Rep_Account account = new Rep_Account();

                DataTable accTable = account.SelectAcc(int.Parse(userId), int.Parse(accId));

                if (accTable.Rows.Count > 0)
                {
                    accNo.Text   = accTable.Rows[0]["AccNo"].ToString();
                    accName.Text = accTable.Rows[0]["AccName"].ToString();
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += errText;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
        private void Udt_Account_Crdt()
        {
            try
            {
                Rep_General general     = new Rep_General();
                Rep_Account accountCrdt = new Rep_Account();
                string      value       = Request.QueryString[general.ObfuscateQueryString("accID")].ToString();
                DataTable   user        = (DataTable)Session["user"];

                int    userId        = int.Parse(user.Rows[0]["UserID"].ToString());
                int    accId         = general.DecryptIds(int.Parse(value));
                int    crdtNo        = int.Parse(txtCrdtNo.Text);
                byte   crdtCategory1 = byte.Parse(dllCategory_1.Text);
                byte   crdtCategory2 = byte.Parse(dllCategory_2.Text);
                byte   crdtType      = byte.Parse(dllType.Text);
                double crdtMax       = double.Parse(txtMax.Text);
                double crdtExtra     = double.Parse(txtExtra.Text);
                byte   crdtStop      = byte.Parse(RBLBlocked.Text);
                byte   crdtResp      = byte.Parse(dllResponsible.Text);
                string crdtMemo      = txtMemo.InnerText;

                string aUpdateCrdtccUdt = accountCrdt.UpdateCrdt(userId, accId, crdtNo, crdtCategory1, crdtCategory2, crdtType, crdtMax, crdtExtra, crdtStop, crdtResp, crdtMemo);

                Disable_Fields();
                Select_Account_Crdt();

                hidnViewFlag.Value = "View";
                lblSubject.Text    = "View";
                Btn_Fields_Roles();

                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", aUpdateCrdtccUdt), true);
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += error;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
        protected void btnLinkContact_OnClick(object sender, EventArgs e)
        {
            try
            {
                Rep_General general     = new Rep_General();
                Rep_Account contactLink = new Rep_Account();
                DataTable   user        = (DataTable)Session["user"];

                int userId = int.Parse(user.Rows[0]["UserID"].ToString());
                int accId  = general.DecryptIds(int.Parse(Request.QueryString[general.ObfuscateQueryString("accID")].ToString()));

                int  accContactId = int.Parse(lblAccId.Text);
                byte contactType  = byte.Parse(ddlContactType.Text);

                contactLink.Contact_Link(userId, accId, accContactId, contactType);

                //return to contact page
                string module = general.SelectModule(userId, "AccountContact");
                if (module != "Stop")
                {
                    int value = int.Parse(Request.QueryString[general.ObfuscateQueryString("accID")].ToString());
                    Response.Redirect("~/Modules/" + module + ".aspx?" + general.ObfuscateQueryString("accID") + "=" + value + "", false);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", "Access Denied"), true);
                }
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += errText;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
        private void Get_ContactType()
        {
            try
            {
                Rep_General general     = new Rep_General();
                Rep_Account accountUdt  = new Rep_Account();
                DataTable   User        = (DataTable)Session["user"];
                DataTable   accUdtTable = new DataTable();

                string userId = User.Rows[0]["UserID"].ToString();
                string accId  = "";
                if (Request.QueryString[general.ObfuscateQueryString("accID")] != null)
                {
                    string value = Request.QueryString[general.ObfuscateQueryString("accID")].ToString();
                    accId       = general.DecryptIds(int.Parse(value)).ToString();
                    accUdtTable = accountUdt.SelectAcc(int.Parse(userId), int.Parse(accId));
                }
                else
                {
                }

                ddlContactType.DataSource     = SelectddlDataTable("SP_SysCode_AccContact_Type", accUdtTable.Rows[0]["AccCategory"].ToString());
                ddlContactType.DataTextField  = "ContactType";
                ddlContactType.DataValueField = "ContactTypeID";
                ddlContactType.DataBind();
                ddlContactType.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += errText;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Get_Navegation_Panel();

            if (!IsPostBack)
            {
                Generate_Buttons();
                Rep_General general = new Rep_General();

                if (Request.QueryString[general.ObfuscateQueryString("accID")] != null)
                {
                    if (hidnViewFlag.Value == "Update")
                    {
                        //hidnViewFlag.Value = "Update";
                        lblSubject.Text = "Edit";
                    }
                    else if (hidnViewFlag.Value == "Add")
                    {
                        //hidnViewFlag.Value = "Add";
                        lblSubject.Text = "New";
                    }

                    else
                    {
                        hidnViewFlag.Value = "View";
                        lblSubject.Text    = "View";



                        AccIDEnc.Value = Request.QueryString[general.ObfuscateQueryString("accID")].ToString();

                        DataTable User = Session["user"] != null ? (DataTable)Session["user"] : new DataTable();
                        if (User.Rows.Count > 0)
                        {
                            UserID.Value   = User.Rows[0]["UserID"].ToString();
                            lblAccID.Text  = general.DecryptIds(int.Parse(AccIDEnc.Value)).ToString();
                            AccIDDec.Value = lblAccID.Text;



                            string texttaccNo = Request.QueryString[general.ObfuscateQueryString("accNo")] != null
                                ? Request.QueryString[general.ObfuscateQueryString("accNo")].ToString()
                                : "";
                            accNo.Text = texttaccNo != string.Empty ? general.DecryptIds(int.Parse(texttaccNo)).ToString() : "";

                            Rep_Account account = new Rep_Account();

                            DataTable accTable = account.SelectAcc(int.Parse(UserID.Value), int.Parse(AccIDDec.Value));

                            accName.Text = accTable.Rows.Count > 0 ? accTable.Rows[0]["AccName"].ToString() : string.Empty;


                            FillDDLs();

                            FillAccountSales(GetAccountSales());
                        }
                        else
                        {
                            B_11_OnClick(null, null);
                        }
                    }


                    //get Roles after check the flag value
                    Btn_Fields_Roles();
                    DisableEdit();
                }
                else
                {
                    B_11_OnClick(null, null);
                }
            }
            else
            {
                // FillAccountInfoGRD();
            }
        }
        protected void Export_OnClick(object sender, EventArgs e)
        {
            //CustomersGRD.ExportSettings.ExportOnlyData = true;
            //CustomersGRD.ExportSettings.IgnorePaging = true;
            //CustomersGRD.ExportSettings.OpenInNewWindow = false;
            //CustomersGRD.ExportSettings.UseItemStyles = true;
            ////CustomersGRD.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
            //CustomersGRD.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;
            ////CustomersGRD.ExportSettings.Excel.Format = (GridExcelExportFormat)Enum.Parse(typeof(GridExcelExportFormat), "Xlsx");
            ////CustomersGRD.ExportSettings.FileName = "Customers (" + DateTime.Now + ")";
            //CustomersGRD.ExportSettings.FileName = string.Format("Customers_{0}", DateTime.Now);
            //CustomersGRD.MasterTableView.ExportToExcel();

            //PostBackTrigger trigger = new PostBackTrigger();
            //trigger.ControlID = "B_42";

            //AccountUpdatePanel.Triggers.Add(trigger);
            //TriggerId = ID.ToString();



            DataTable expCustomersDt = new DataTable();

            //expCustomersDt = SelectCustomers();

            try
            {
                Rep_Account accountSearch = new Rep_Account();

                DataTable User   = (DataTable)Session["user"];
                string    userId = User.Rows[0]["UserID"].ToString();

                expCustomersDt = accountSearch.SelectSearch(int.Parse(userId), "Excel", SearchTXT.Text, "AccountSearch");
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "Error occurred please try again ";
                AlertMSG += errText;
                this.ClientScript.RegisterStartupScript(this.GetType(), this.GetType().Name,
                                                        string.Format("window.alert('{0}');", AlertMSG), true);
            }

            if (expCustomersDt.Rows.Count <= 0)
            {
                //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", "No records to export"), true);
            }
            else
            {
                expCustomersDt.Columns.Remove("AccID");

                using (XLWorkbook wb = new XLWorkbook())
                {
                    wb.Worksheets.Add(expCustomersDt, "Accounts");
                    Response.Clear();
                    Response.Buffer      = true;
                    Response.Charset     = "";
                    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                    Response.AddHeader("content-disposition", "attachment;filename=" + string.Format("Accounts_{0}", DateTime.Now) + ".xlsx");
                    using (MemoryStream MyMemoryStream = new MemoryStream())
                    {
                        wb.SaveAs(MyMemoryStream);
                        MyMemoryStream.WriteTo(Response.OutputStream);
                        Response.Flush();
                        Response.End();
                    }
                }
            }
        }
        private DataTable SelectCustomers()
        {
            //string SelectCommand = "SELECT  Account.AccID, Account.AccNo, Account.AccName, Account.Cancelled, AccountInfo.LineID, AccountInfo.InfoType, AccountInfo.InfoData, AccountInfo.Cancelled AS Expr1 "
            //                                             + " FROM Account INNER JOIN                                                                     "
            //                                             + " AccountInfo ON Account.AccID = AccountInfo.AccID                                            "
            //                                             + " and Account.Cancelled = 0                                                                   "
            //                                             + " and CONCAT(Account.AccNo ,' ' , Account.AccName ,' ', AccountInfo.InfoData) like @search       ";

            //SqlCommand SqlSelectCommand = new SqlCommand(SelectCommand, CustomersConnection);
            // SqlSelectCommand.Parameters.Add("@SearchText", SqlDbType.NVarChar, 65);
            //     SqlSelectCommand.Parameters.Add("@SearchText", System.Data.SqlDbType.Text);
            //     SqlSelectCommand.Parameters["@SearchText"].Value = SearchTXT.Text;

            //     adapter.InsertCommand.Parameters.Add("@CompanyName",
            //SqlDbType.VarChar, 40, "CompanyName");

            //SqlDataAdapter CustomersDA = new SqlDataAdapter("SP_Account_Search", CustomersConnection);
            //CustomersDA.SelectCommand.CommandType = CommandType.StoredProcedure;
            //CustomersDA.SelectCommand.Parameters.AddWithValue("@UserID", userId);
            //CustomersDA.SelectCommand.Parameters.AddWithValue("@SearchType", "Mobile");
            //CustomersDA.SelectCommand.Parameters.AddWithValue("@ModuleName", "AccountSearch");
            //CustomersDA.SelectCommand.Parameters.AddWithValue("@search", "%" + SearchTXT.Text + "%");
            //CustomersDA.SelectCommand.Parameters.AddWithValue("@SearchText", SearchTXT.Text);
            //Add(SearchTXT.Text);
            //CustomersDA.Fill(CustomersDT);

            DataTable CustomersDT = new DataTable();
            DataTable boundTable  = new DataTable();

            try
            {
                Rep_Account accountSearch = new Rep_Account();
                Rep_General general       = new Rep_General();

                DataTable User   = (DataTable)Session["user"];
                string    userId = User.Rows[0]["UserID"].ToString();

                CustomersDT = accountSearch.SelectSearch(int.Parse(userId), "Mobile", SearchTXT.Text, "AccountSearch");

                //if query string
                if (Request.QueryString[general.ObfuscateQueryString("accID")] != null)
                {
                    DataTable contactsDt = new DataTable();
                    int       accId      = general.DecryptIds(int.Parse(Request.QueryString[general.ObfuscateQueryString("accID")].ToString()));
                    contactsDt = accountSearch.SelectContactSearch(int.Parse(userId), accId.ToString());

                    //var rows = from r in CustomersDT.AsEnumerable()
                    //    //make sure there aren't any matching names in dt2
                    //    where contactsDt.AsEnumerable().Any(r2 => r["AccID"].ToString() != r2["AccID"].ToString() && r["AccID"].ToString() != accId.ToString())
                    //    select r;

                    //var rows = CustomersDT.AsEnumerable().Where(r => contactsDt.AsEnumerable()
                    //    //make sure there aren't any matching names in dt2
                    //    .Any( r2 => r["AccID"].ToString() != r2["AccID"].ToString() ));

                    //boundTable = rows.CopyToDataTable();

                    if (CustomersDT.Rows.Count > 0)
                    {
                        boundTable = CustomersDT.Rows.OfType <DataRow>()
                                     .Where(a => CustomersDT.Rows.OfType <DataRow>().Select(k => Convert.ToInt32(k["AccID"])).Except(contactsDt.Rows.OfType <DataRow>()
                                                                                                                                     .Select(k => Convert.ToInt32(k["AccID"])).ToList()).Contains(Convert.ToInt32(a["AccID"])) && Convert.ToInt32(a["AccID"]) != accId).CopyToDataTable();
                    }
                }
                else
                {
                    if (CustomersDT.Rows.Count > 0)
                    {
                        boundTable = CustomersDT;
                    }
                }
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "Error occurred please try again ";
                AlertMSG += errText;
                this.ClientScript.RegisterStartupScript(this.GetType(), this.GetType().Name,
                                                        string.Format("window.alert('{0}');", AlertMSG), true);
            }

            return(boundTable);
        }