Esempio n. 1
0
        /// <summary>
        /// To fetch bank details from database based on bankname
        /// </summary>
        /// <param name="bankName"></param>
        /// <returns></returns>
        public BankList GetAllBanks(string bankName)
        {
            proc = "USP_MST_GET_ALLBANKS";
            BankBO   objBank = null;
            BankList Banks   = new BankList();

            using (cnn = new OracleConnection(con))
            {
                using (cmd = new OracleCommand(proc, cnn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    if (bankName != "")
                    {
                        cmd.Parameters.Add("bankName_", bankName);
                    }
                    else
                    {
                        cmd.Parameters.Add("bankName_", DBNull.Value);
                    }


                    cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

                    try
                    {
                        cmd.Connection.Open();
                        OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                        while (dr.Read())
                        {
                            objBank = new BankBO();

                            if (!dr.IsDBNull(dr.GetOrdinal("BankID")))
                            {
                                objBank.BankID = dr.GetInt32(dr.GetOrdinal("BankID"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("BankName")))
                            {
                                objBank.BankName = dr.GetString(dr.GetOrdinal("BankName"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("IsDeleted")))
                            {
                                objBank.IsDeleted = dr.GetString(dr.GetOrdinal("IsDeleted"));
                            }

                            Banks.Add(objBank);
                        }

                        dr.Close();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }

            return(Banks);
        }
Esempio n. 2
0
        /// <summary>
        /// To update bank details into database
        /// </summary>
        /// <param name="objBank"></param>
        /// <returns></returns>
        public string UpdateBank(BankBO objBank)
        {
            cnn = new OracleConnection(con);
            string returnResult = string.Empty;

            proc = "USP_MST_UPD_BANK";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection.Open();

            cmd.Parameters.Add("bankID", objBank.BankID);
            cmd.Parameters.Add("bankName", objBank.BankName);

            cmd.Parameters.Add("updatedby", objBank.UpdatedBy);
            cmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;
            cmd.ExecuteNonQuery();

            if (cmd.Parameters["errorMessage_"].Value != null)
            {
                returnResult = cmd.Parameters["errorMessage_"].Value.ToString();
            }
            else
            {
                returnResult = string.Empty;
            }

            cmd.Connection.Close();
            return(returnResult);
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// used to get page header
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void getpageHeader()
        {
            BankBO ObjBankBO = (new BankBLL()).GetBankByBankID(Convert.ToInt32(ViewState["BANK_ID"]));

            if (ObjBankBO != null)
            {
                Master.PageHeader = "Branches for " + ObjBankBO.BankName;
            }
        }
Esempio n. 4
0
        private void ProcessForm(int id, bool isDelete)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    BankBO objBank = new BankBO(this.ObjContext);
                    if (id > 0)
                    {
                        objBank.ID = id;
                        objBank.GetObject();

                        objBank.Name         = this.txtName.Text;
                        objBank.Branch       = this.txtBranch.Text;
                        objBank.Number       = this.txtNumber.Text;
                        objBank.Address      = this.txtAddress.Text;
                        objBank.City         = this.txtCity.Text;
                        objBank.State        = this.txtState.Text;
                        objBank.Postcode     = this.txtPostcode.Text;
                        objBank.Country      = int.Parse(this.ddlCountry.SelectedValue);
                        objBank.AccountNo    = this.txtAccountNo.Text;
                        objBank.SwiftCode    = this.txtSwiftCode.Text;
                        objBank.Modifier     = this.LoggedUser.ID;
                        objBank.ModifiedDate = DateTime.Now;

                        if (isDelete)
                        {
                            objBank.Delete();
                        }
                    }
                    else
                    {
                        objBank.Name        = this.txtName.Text;
                        objBank.Branch      = this.txtBranch.Text;
                        objBank.Number      = this.txtNumber.Text;
                        objBank.Address     = this.txtAddress.Text;
                        objBank.City        = this.txtCity.Text;
                        objBank.State       = this.txtState.Text;
                        objBank.Postcode    = this.txtPostcode.Text;
                        objBank.Country     = int.Parse(this.ddlCountry.SelectedValue);
                        objBank.AccountNo   = this.txtAccountNo.Text;
                        objBank.SwiftCode   = this.txtSwiftCode.Text;
                        objBank.Creator     = this.LoggedUser.ID;
                        objBank.CreatedDate = DateTime.Now;
                        objBank.Add();
                    }

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                IndicoLogging.log.Error("Error occured while editing, updating or insering a Bank in ViewBank.aspx page", ex);
            }
        }
Esempio n. 5
0
 public void AddBank(int branchId, BankBO bank)
 {
     _unitOfWork.BankTable.AddSingle(new BankDetail
     {
         Code             = bank.Code,
         Name             = bank.Name,
         BrancheDetailsId = branchId
     });
     _unitOfWork.Commit();
 }
Esempio n. 6
0
        public void UpdateBank(BankBO bank)
        {
            var bankDetails = new BankDetail
            {
                Name = bank.Name,
                Code = bank.Code
            };

            _unitOfWork.BankTable.UpdateSingle(bank.Id, bankDetails);
            _unitOfWork.Commit();
        }
Esempio n. 7
0
        private void PopulateDataGrid()
        {
            {
                // Hide Controls
                this.dvEmptyContent.Visible   = false;
                this.dvDataContent.Visible    = false;
                this.dvNoSearchResult.Visible = false;

                // Search text
                string searchText = this.txtSearch.Text.ToLower().Trim();

                // Populate Items
                BankBO objBank = new BankBO();

                List <BankBO> lstBank = new List <BankBO>();
                if ((searchText != string.Empty) && (searchText != "search"))
                {
                    lstBank = (from o in objBank.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList()
                               where o.Name.ToLower().Contains(searchText) ||
                               o.Branch.ToLower().Contains(searchText) ||
                               o.AccountNo.ToLower().Contains(searchText) ||
                               (o.SwiftCode != null ? o.SwiftCode.ToLower().Contains(searchText) : false)
                               select o).ToList();
                }
                else
                {
                    lstBank = objBank.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList();
                }

                if (lstBank.Count > 0)
                {
                    this.RadGridBank.AllowPaging = (lstBank.Count > this.RadGridBank.PageSize);
                    this.RadGridBank.DataSource  = lstBank;
                    this.RadGridBank.DataBind();
                    Session["BankDetails"] = lstBank;

                    this.dvDataContent.Visible = true;
                }
                else if ((searchText != string.Empty && searchText != "search"))
                {
                    this.lblSerchKey.Text = searchText + ((searchText != string.Empty) ? " - " : string.Empty);

                    this.dvDataContent.Visible    = true;
                    this.dvNoSearchResult.Visible = true;
                }
                else
                {
                    this.dvEmptyContent.Visible = true;
                    this.btnAddAgeGroup.Visible = false;
                }

                this.RadGridBank.Visible = (lstBank.Count > 0);
            }
        }
Esempio n. 8
0
        protected void RadGridBank_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = e.Item as GridDataItem;

                if (item.ItemIndex > -1 && item.DataItem is BankBO)
                {
                    BankBO objBank = (BankBO)item.DataItem;

                    HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit");
                    linkEdit.Attributes.Add("qid", objBank.ID.ToString());

                    HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete");
                    linkDelete.Attributes.Add("qid", objBank.ID.ToString());
                    linkDelete.Visible = (objBank.InvoicesWhereThisIsBank.Count == 0);
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// To Get Bank details  By BankID
        /// </summary>
        /// <param name="bankID"></param>
        /// <returns></returns>
        public BankBO GetBankByBankID(int bankID)
        {
            proc = "USP_MST_GET_BANKBYID";
            cnn  = new OracleConnection(con);
            BankBO objBank = null;

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("bankID_", bankID);

            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            try
            {
                cmd.Connection.Open();
                OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                while (dr.Read())
                {
                    objBank = new BankBO();

                    if (!dr.IsDBNull(dr.GetOrdinal("BankID")))
                    {
                        objBank.BankID = dr.GetInt32(dr.GetOrdinal("BankID"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("BankName")))
                    {
                        objBank.BankName = dr.GetString(dr.GetOrdinal("BankName"));
                    }
                }

                dr.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(objBank);
        }
Esempio n. 10
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdBanks_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            try
            {
                if (e.CommandName == "EditRow")
                {
                    ShowHideSections(true, false);
                    ViewState["BANK_ID"] = e.CommandArgument;
                    BankBLL objBankBLL = new BankBLL();
                    BankBO  objBank    = objBankBLL.GetBankByBankID(Convert.ToInt32(ViewState["BANK_ID"]));

                    txtBankName.Text = objBank.BankName;
                    btnSave.Text     = "Update";
                    btnClear.Text    = "Cancel";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
                }

                else if (e.CommandName == "DeleteRow")
                {
                    BankBLL objBankBLL = new BankBLL();

                    message = objBankBLL.DeleteBank(Convert.ToInt32(e.CommandArgument));
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data deleted successfully";
                    }
                    ClearDetails();
                    BindBanks(false, true);
                }
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
 /// <summary>
 /// To update bank details into database
 /// </summary>
 /// <param name="objBank"></param>
 /// <returns></returns>
 public string UpdateBank(BankBO objBank)
 {
     return((new BankDAL()).UpdateBank(objBank));
 }
Esempio n. 13
0
 /// <summary>
 /// To save bank data to database
 /// </summary>
 /// <param name="objBank"></param>
 /// <returns></returns>
 public string AddBank(BankBO objBank)
 {
     return((new BankDAL()).AddBank(objBank));
 }