Пример #1
0
        public static List <IUser> GetUserList(bool isActiveOnly, SearchCriteria searchCriteria)
        {
            List <IUser> lstUser = new List <IUser>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[webadmin].[uspGetUser]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@IsActiveOnly", isActiveOnly);
                helper.Parameters.Add("@SchUserName", searchCriteria.UserName);
                helper.Parameters.Add("@SchFirstName", searchCriteria.FirstName);
                helper.Parameters.Add("@SortExpression", searchCriteria.SortExpression);
                helper.Parameters.Add("@SortDirection", searchCriteria.SortDirection);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    IUser user = new UserEntity(helper.DataReader);
                    lstUser.Add(user);
                }

                helper.Close();
            }

            return(lstUser);
        }
Пример #2
0
        public static IUser GetUser(int userId, bool isActiveOnly, SearchCriteria searchCriteria)
        {
            IUser user = null;

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[webadmin].[uspGetUser]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@UserId", userId);
                helper.Parameters.Add("@IsActiveOnly", isActiveOnly);
                helper.Parameters.Add("@SortExpression", searchCriteria.SortExpression);
                helper.Parameters.Add("@SortDirection", searchCriteria.SortDirection);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    user = new UserEntity(helper.DataReader);
                }

                helper.Close();
            }

            return(user);
        }
Пример #3
0
        public static List <IRole> GetRole(bool isActiveOnly, SearchCriteria searchCriteria)
        {
            List <IRole> lstRole = new List <IRole>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[webadmin].[uspGetRole]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@IsActiveOnly", isActiveOnly);
                helper.Parameters.Add("@SchRole", searchCriteria.RoleName);
                helper.Parameters.Add("@SortExpression", searchCriteria.SortExpression);
                helper.Parameters.Add("@SortDirection", searchCriteria.SortDirection);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    IRole role = new RoleEntity(helper.DataReader);
                    lstRole.Add(role);
                }

                helper.Close();
            }

            return(lstRole);
        }
Пример #4
0
        public static List <ReportEntity> GetCashierWiseSale(ReportCriteria criteria)
        {
            List <ReportEntity> lstData = new List <ReportEntity>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[dbo].[sp_rpt_CASHIERWISESALE]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@Mode", criteria.CashierId);
                helper.Parameters.Add("@StartDate", criteria.FromDate);
                helper.Parameters.Add("@EndDate", criteria.ToDate);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    ReportEntity report = new ReportEntity();
                    report.LoadCashierWiseSale(helper.DataReader);
                    lstData.Add(report);
                }

                helper.Close();
            }

            return(lstData);
        }
Пример #5
0
        public static List <ReportEntity> GetStockLedger(ReportCriteria criteria)
        {
            List <ReportEntity> lstData = new List <ReportEntity>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[rpt].[sp_rpt_STOCKREGISTER]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@StartDate", criteria.FromDate);
                helper.Parameters.Add("@EndDate", criteria.ToDate);
                //helper.Parameters.Add("@Mode", criteria.FromDate);
                //helper.Parameters.Add("@OBDate", criteria.FromDate);
                //helper.Parameters.Add("@ItemCode", criteria.FromDate);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    ReportEntity report = new ReportEntity(helper.DataReader);
                    report.LoadStockLedger(helper.DataReader);
                    lstData.Add(report);
                }

                helper.Close();
            }

            return(lstData);
        }
Пример #6
0
        public static List <ReportEntity> GetBillWiseSaleRefund(ReportCriteria criteria)
        {
            List <ReportEntity> lstData = new List <ReportEntity>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[dbo].[sp_rpt_SALEREFUNDREGISTER]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@TranType", criteria.TransactionType);
                helper.Parameters.Add("@StartDate", criteria.FromDate);
                helper.Parameters.Add("@EndDate", criteria.ToDate);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    ReportEntity report = new ReportEntity();
                    report.LoadBillWiseSaleRefund(helper.DataReader);
                    lstData.Add(report);
                }

                helper.Close();
            }

            return(lstData);
        }
Пример #7
0
        public static List <IItemGroup> GetItemGroup(char mode, int lvl, Int64 userId)
        {
            List <IItemGroup> lstGroup = new List <IItemGroup>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[dbo].[sp_Manage_ITEMGROUP]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@Mode", mode);
                helper.Parameters.Add("@UserID", userId);
                helper.Parameters.Add("@Lvl", lvl);
                helper.Parameters.Add("@Result", SqlDbType.Int, ParameterDirection.Output);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    IItemGroup group = new ItemGroupEntity(helper.DataReader);
                    lstGroup.Add(group);
                }

                helper.Close();
            }

            return(lstGroup);
        }
Пример #8
0
        public static IRoleMenu GetMenuAccessByUser(int userId, int menuId)
        {
            IRoleMenu roleMenu = null;

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[webadmin].[uspGetMenuAccessByUser]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@UserId", userId);
                helper.Parameters.Add("@MenuId", menuId);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    roleMenu = new RoleMenuEntity(helper.DataReader);
                }

                helper.Close();
            }

            return(roleMenu);
        }
Пример #9
0
        public static void ValidateUser(IUser user)
        {
            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[webadmin].[uspValidateUser]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@UserName", user.Name);
                helper.Parameters.Add("@Password", user.Password);

                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    user.Id          = Convert.ToInt32(helper.DataReader["UserId"]);
                    user.FirstName   = Convert.ToString(helper.DataReader["FirstName"]);
                    user.LastName    = Convert.ToString(helper.DataReader["LastName"]);
                    user.UserRole.Id = Convert.ToInt32(helper.DataReader["RoleId"]);
                    user.EmailId     = Convert.ToString(helper.DataReader["emailID"]);
                }

                helper.Close();
            }
        }
Пример #10
0
        public static List <IRoleMenu> GetMenuByRole(int roleId, int mainId)
        {
            List <IRoleMenu> lstMenu = new List <IRoleMenu>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[webadmin].[uspGetMenuByRole]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@RoleId", roleId);
                helper.Parameters.Add("@MainId", mainId);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    IRoleMenu menu = new RoleMenuEntity(helper.DataReader);
                    lstMenu.Add(menu);
                }

                helper.Close();
            }

            return(lstMenu);
        }
Пример #11
0
        public static List <ReportEntity> GetCashierLog(ReportCriteria criteria)
        {
            List <ReportEntity> lstData = new List <ReportEntity>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[rpt].[]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@", 1);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    ReportEntity report = new ReportEntity(helper.DataReader);
                    report.LoadCashierLog(helper.DataReader);
                    lstData.Add(report);
                }

                helper.Close();
            }

            return(lstData);
        }