public List <BankAccountLedgerHead> GetBankLedgerHeadList()
        {
            List <BankAccountLedgerHead> balList = new List <BankAccountLedgerHead>();

            try
            {
                using (SqlConnection connection = DataAccess.CreateConnection())
                {
                    SqlCommand command = DataAccess.CreateCommand(connection);

                    DataAccess.CreateStoredprocedure(command, "GetBankLedgerHeadList_SP");
                    SqlDataReader reader = DataAccess.ExecuteReader(command);
                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            BankAccountLedgerHead bal = new BankAccountLedgerHead();
                            bal.Id          = reader["Id"] is DBNull ? 0 : Convert.ToInt32(reader["Id"]);
                            bal.LedgerHead  = reader["LedgerHead"] is DBNull ? string.Empty : Convert.ToString(reader["LedgerHead"]);
                            bal.LedgerTypes = reader["LedgerTypes"] is DBNull ? 0 : (LedgerType)(reader["LedgerTypes"]);
                            bal.Editable    = reader["Editable"] is DBNull ? false : Convert.ToBoolean(reader["Editable"]);
                            bal.Status      = reader["Status"] is DBNull ? false : Convert.ToBoolean(reader["Status"]);
                            balList.Add(bal);
                        }
                    }
                    reader.Close();
                    return(balList);
                }
            }
            catch (Exception ex)
            {
                return(balList);
            }
        }
        public bool InsertNewBankLedgerHead(BankAccountLedgerHead model)
        {
            try
            {
                int status = 0;
                using (SqlConnection connection = DataAccess.CreateConnection())
                {
                    SqlCommand command = DataAccess.CreateCommand(connection);

                    DataAccess.CreateStoredprocedure(command, "InsertNewBankLedgerHead_SP");
                    DataAccess.AddInParameter(command, "@LedgerHead", SqlDbType.VarChar, model.LedgerHead);
                    DataAccess.AddInParameter(command, "@LedgerType", SqlDbType.Int, (int)model.LedgerTypes);
                    status = DataAccess.ExecuteNonQuery(command);
                    if (status < 0)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        public ActionResult LedgerHead(BankAccountLedgerHead model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (model == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            else
            {
                BankAccountLedgerHead obj = new BankAccountLedgerHead();
                obj.LedgerHead  = model.LedgerHead;
                obj.LedgerTypes = model.LedgerTypes;
                new BankDA().InsertNewBankLedgerHead(obj);

                return(RedirectToAction("LedgerHead", "Banks"));
            }
        }