Example #1
0
        } //========== end of the mtd

        public IEnumerable <Models.IncomeAccountsListingModel> GetIncomeAccountsListingUsingParams(string search)
        {
            List <IncomeAccountsListingModel> obList = new List <IncomeAccountsListingModel>();

            using (var con = new System.Data.SqlClient.SqlConnection(connectionString))
            {
                var cmd = new System.Data.SqlClient.SqlCommand("", con);

                con.Open();
                //cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.CommandText = "SELECT top 1000 * FROM Income_AccountsListing "
                                  + " where ACCOUNTNUMBER like @searchval";
                cmd.Parameters.AddWithValue("@searchval", "%" + search + "%");
                //cmd.CommandTimeout = 0;

                //cmd.Parameters.Add("@result", System.Data.SqlDbType.TinyInt).Direction = System.Data.ParameterDirection.Output;


                //cmd.ExecuteNonQuery();
                //cmd2.ExecuteNonQuery();

                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    var ob = new IncomeAccountsListingModel();

                    //iob.ID = reader["ID"] != DBNull.Value ? int.Parse(reader["ID"].ToString()) : 0;
                    ob.ACCOUNTNUMBER       = reader["ACCOUNTNUMBER"] != DBNull.Value ? reader["ACCOUNTNUMBER"].ToString() : "default";
                    ob.CustomerName        = reader["CustomerName"] != DBNull.Value ? reader["CustomerName"].ToString() : "default";
                    ob.MIS_CODE            = reader["MIS_CODE"] != DBNull.Value ? reader["MIS_CODE"].ToString() : "default";
                    ob.BranchCode          = reader["BranchCode"] != DBNull.Value ? reader["BranchCode"].ToString() : "default";
                    ob.accountofficer_code = reader["accountofficer_code"] != DBNull.Value ? reader["accountofficer_code"].ToString() : "default";
                    ob.Team_branch         = reader["Team_branch"] != DBNull.Value ? reader["Team_branch"].ToString() : "default";
                    ob.Date_Open           = reader["Date_Open"] != DBNull.Value ? DateTime.Parse(reader["Date_Open"].ToString()) : DateTime.Parse("1000-01-01");

                    obList.Add(ob);
                }
                con.Close();
            }
            return(obList);
        } //========== end of the mtd
Example #2
0
        public IEnumerable <Models.IncomeAccountsListingModel> GetIncomeAccountsListing()
        {
            List <IncomeAccountsListingModel> obList = new List <IncomeAccountsListingModel>();

            using (var con = new System.Data.SqlClient.SqlConnection(connectionString))
            {
                var cmd = new System.Data.SqlClient.SqlCommand("", con);

                con.Open();
                //cmd.CommandType = System.Data.CommandType.StoredProcedure;
                //cmd.CommandText = "SELECT top 3000 TableName, PkgName, ExecStartDT, ExecStopDT, ExtractRowCnt, InsertRowCnt, UpdateRowCnt, ErrorRowCnt, TableInitialRowCnt, TableFinalRowCnt, SuccessfulProcessingInd FROM [10.1.7.117\fintraksql].fintrakdaily.dbo.dimaudit";
                cmd.CommandText = "SELECT top 500 * FROM Income_AccountsListing";

                //cmd.CommandTimeout = 0;

                //cmd.Parameters.Add("@result", System.Data.SqlDbType.TinyInt).Direction = System.Data.ParameterDirection.Output;


                //cmd.ExecuteNonQuery();
                //cmd2.ExecuteNonQuery();

                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    var ob = new IncomeAccountsListingModel();

                    //iob.ID = reader["ID"] != DBNull.Value ? int.Parse(reader["ID"].ToString()) : 0;
                    ob.ACCOUNTNUMBER       = reader["ACCOUNTNUMBER"] != DBNull.Value ? reader["ACCOUNTNUMBER"].ToString() : "default";
                    ob.CustomerName        = reader["CustomerName"] != DBNull.Value ? reader["CustomerName"].ToString() : "default";
                    ob.MIS_CODE            = reader["MIS_CODE"] != DBNull.Value ? reader["MIS_CODE"].ToString() : "default";
                    ob.BranchCode          = reader["BranchCode"] != DBNull.Value ? reader["BranchCode"].ToString() : "default";
                    ob.accountofficer_code = reader["accountofficer_code"] != DBNull.Value ? reader["accountofficer_code"].ToString() : "default";
                    ob.Team_branch         = reader["Team_branch"] != DBNull.Value ? reader["Team_branch"].ToString() : "default";
                    ob.Date_Open           = reader["Date_Open"] != DBNull.Value ? DateTime.Parse(reader["Date_Open"].ToString()) : DateTime.Parse("1000-01-01");

                    obList.Add(ob);
                }
                con.Close();
            }
            return(obList);
        } //========== end of the mtd