示例#1
0
        public static List <ClientsRecord> AllUserList()
        {
            List <ClientsRecord> UserList = new List <ClientsRecord>();

            using (DBClass context = new DBClass())
            {
                DataTable dt = context.getData("getAllUserList", CommandType.StoredProcedure);
                foreach (DataRow dr in dt.Rows)
                {
                    UserList.Add(new ClientsRecord
                    {
                        UserName = Convert.ToString(dr["UserName"]),
                        Name     = dr["Name"].ToString(),
                        //Company = Convert.ToString(dr["Company"]),
                        Phone       = Convert.ToString(dr["Phone"]),
                        EmailID     = Convert.ToString(dr["Email_ID"]),
                        CreatedDate = Convert.ToDateTime(dr["CreationDate"]),
                        UserRole    = Convert.ToString(dr["UserRole"]),
                    });
                }
                return(UserList);
            }
        }
        public List <Enquiry> getAllEnquiryData()
        {
            List <Enquiry> enquiryList = new List <Enquiry>();  // creating list of model.
            DataTable      dt          = new DataTable();

            using (DBClass context = new DBClass())
            {
                dt = context.getData("getAllEnquiry", CommandType.StoredProcedure);
                foreach (DataRow dr in dt.Rows)
                {
                    enquiryList.Add(new Enquiry
                    {
                        EnquiryID      = Convert.ToString(dr["ID"]),
                        UserName       = Convert.ToString(dr["UserName"]),
                        Enq_Category   = Convert.ToString(dr["EnquiryCategory"]),
                        Enq_Subject    = Convert.ToString(dr["EnquirySubject"]),
                        EnquiryDetail1 = Convert.ToString(dr["EnquiryDetail"]),
                        Enq_CreateDate = Convert.ToString(dr["CreateDate"]),
                        Buyer_Count    = Convert.ToInt32(dr["Buyer_Count"])
                    });
                }
                return(enquiryList);
            }
        }