Пример #1
0
        /// <summary>
        /// Save and Update Data into Database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BankBO objBank = new BankBO();

            objBank.BankID   = Convert.ToInt32(ViewState["BANK_ID"]);
            objBank.BankName = txtBankName.Text.Trim();

            BankBLL objBankBLL   = new BankBLL();
            string  AlertMessage = string.Empty;
            string  message      = string.Empty;

            if (objBank.BankID == 0)
            {
                objBank.CreatedBy = Convert.ToInt32(Session["USER_ID"]);
                message           = objBankBLL.AddBank(objBank);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                    ClearDetails();
                }
            }
            else
            {
                objBank.UpdatedBy = Convert.ToInt32(Session["USER_ID"]);
                message           = objBankBLL.UpdateBank(objBank);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                    ClearDetails();
                }
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);

            BindBanks(true, false);
        }