Esempio n. 1
0
        public List <BOThirdCategory> SelectThirdCategoryList(BOThirdCategory btcat)
        {
            SqlCommand     _sqlcommand;
            SqlDataAdapter _sqlDataAdapter;

            using (SqlConnection _con = ConnectionInfo.GetConnection())
            {
                _sqlcommand             = new SqlCommand();
                _sqlcommand.CommandText = "SP_GetThirdCategory";
                _sqlcommand.CommandType = System.Data.CommandType.StoredProcedure;
                _sqlcommand.Connection  = _con;
                _con.Open();
                _sqlcommand.Parameters.AddWithValue("@Event", btcat.Event);
                _sqlDataAdapter = new SqlDataAdapter(_sqlcommand);

                DataTable _dataTable = new DataTable();
                _sqlDataAdapter.Fill(_dataTable);

                List <BOThirdCategory> tcatList = (from cu in _dataTable.AsEnumerable()
                                                   select new BOThirdCategory
                {
                    ThirdCategoryId = cu.Field <int>("ThirdCategoryId"),
                    ThirdCategoryName = cu.Field <string>("ThirdCategoryName"),
                    SecondCategoryId = cu.Field <int>("SecondCategoryId"),
                    SecondCategoryName = cu.Field <string>("SecondCategoryName")
                }).ToList();
                _con.Close();
                return(tcatList);
            }
        }
Esempio n. 2
0
        public int IUDThirdCategory(BOThirdCategory thirdcat)
        {
            int returnvalue = default(int);

            using (SqlConnection _sqlconnection = ConnectionInfo.GetConnection())
            {
                _sqlcommand = new SqlCommand();

                _sqlcommand.Connection  = _sqlconnection;
                _sqlcommand.CommandText = "SP_IUDThirdCategory";
                _sqlcommand.CommandType = CommandType.StoredProcedure;
                _sqlconnection.Open();

                _sqlcommand.Parameters.AddWithValue("@ThirdCategoryId", thirdcat.ThirdCategoryId);
                _sqlcommand.Parameters.AddWithValue("@ThirdCategoryName", thirdcat.ThirdCategoryName);
                _sqlcommand.Parameters.AddWithValue("@SecondCategoryId", thirdcat.SecondCategoryId);
                _sqlcommand.Parameters.AddWithValue("@IsActive", thirdcat.IsActive);
                _sqlcommand.Parameters.AddWithValue("@IsDelete", thirdcat.IsDelete);
                _sqlcommand.Parameters.AddWithValue("@CreatedBy", thirdcat.CreatedBy);
                _sqlcommand.Parameters.AddWithValue("@CreatedDate", thirdcat.CreatedDate);
                _sqlcommand.Parameters.AddWithValue("@UpdatedBy", thirdcat.UpdatedBy);
                _sqlcommand.Parameters.AddWithValue("@UpdatedDate", thirdcat.UpdatedDate);
                _sqlcommand.Parameters.AddWithValue("@Event", thirdcat.Event);
                _sqlcommand.Parameters.AddWithValue("@returnValue", 0).Direction = System.Data.ParameterDirection.InputOutput;

                try
                {
                    _sqlcommand.ExecuteNonQuery();
                    returnvalue = Convert.ToInt32(_sqlcommand.Parameters["@returnValue"].Value);
                }
                catch (Exception ex)
                {
                    Common.LogError(ex);
                }
                finally
                {
                    _sqlconnection.Close();
                    _sqlcommand.Dispose();
                }
            }
            return(returnvalue);
        }
Esempio n. 3
0
 public int Delete(BOThirdCategory _bothirdcate)
 {
     return(datcat.IUDThirdCategory(_bothirdcate));
 }
Esempio n. 4
0
 public int Insert(BOThirdCategory _bothirdcate)
 {
     return(datcat.IUDThirdCategory(_bothirdcate));
 }
Esempio n. 5
0
 public List <BOThirdCategory> SelectThirdCategoryList(BOThirdCategory _bothirdcate)
 {
     return(datcat.SelectThirdCategoryList(_bothirdcate));
 }