예제 #1
0
        public List<MeasuringUnitLookUp> GetAllMeasuringUnitsForLookUp()
        {
            DBEgine objDbAccess = new DBEgine();
            var list = new List<MeasuringUnitLookUp>();
            try
            {

                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("Inventory.GetMeasuringUnits", null);

                while (dr.Read())
                {
                    var item = new MeasuringUnitLookUp();

                    item.UnitID = Convert.ToInt32(dr["UnitID"].ToString());
                    item.UnitDescription = dr["UnitDescription"].ToString();

                    list.Add(item);
                }

                return list;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
예제 #2
0
        public UserLevelsBO GetNextUserLevelByCurrentUserLevelID(int currentUserLevelID)
        {
            DBEgine dbEgine = new DBEgine();
            try
            {
                UserLevelsBO userLevelObj = new UserLevelsBO();

                SqlParameter[] parms = new SqlParameter[1];

                dbEgine.DBOpen();
                SqlParameter userLevelIdParm = new SqlParameter();
                userLevelIdParm.ParameterName = "@UserLevelId";
                userLevelIdParm.SqlDbType = SqlDbType.Int;
                userLevelIdParm.Direction = ParameterDirection.Input;
                userLevelIdParm.Value = currentUserLevelID;
                parms[0] = userLevelIdParm;

                SqlDataReader drUserLevels = dbEgine.ExecuteReader("UserManagement.UM_GetNextUserLevelByCurrentUserLevel", parms);
                if (drUserLevels != null && drUserLevels.HasRows && drUserLevels.Read())
                {
                    userLevelObj = FillUserLevel(drUserLevels);

                }
                return userLevelObj;
            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #3
0
        public List<SubItemLookUp> GetAllSubItemsForLookUp()
        {
            DBEgine objDbAccess = new DBEgine();
            var list = new List<SubItemLookUp>();
            try
            {

                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("Inventory.GetAllSubItems", null);

                while (dr.Read())
                {
                    var subItem = new SubItemLookUp();

                    subItem.SubItemID = int.Parse(dr["SubItemID"].ToString());
                    subItem.SubItemSerial = dr["SubItemSerial"].ToString();
                    subItem.SubItemDescription = dr["SubItemDescription"].ToString();
                    subItem.SubItemUnitPrice = Convert.ToDecimal(dr["SubItemUnitPrice"].ToString());

                    list.Add(subItem);
                }

                return list;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
예제 #4
0
        public DateTime GetCurrentDayProcessDate()
        {
            DBEgine objDbAccess = new DBEgine();
            DateTime currentDate = DateTime.Now;
            try
            {
                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("[admin].GetCurrentDayProcess ", null);

                while (dr.Read())
                {
                    currentDate = DateTime.Parse(dr["DayProcessDate"].ToString());
                }
                return currentDate;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
예제 #5
0
        public List<InvoiceHeaderBO> GetAllInvoicesForCurrentDate()
        {
            DBEgine objDbAccess = new DBEgine();
            var list = new List<InvoiceHeaderBO>();
            try
            {

                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("Sales.GetCurrentDayInvoices", null);

                while (dr.Read())
                {
                    var invoice = new InvoiceHeaderBO();

                    invoice.InvoiceID = int.Parse(dr["InvoiceID"].ToString());
                    invoice.InvoiceNumber = dr["InvoiceNumber"].ToString();

                    list.Add(invoice);
                }

                return list;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
예제 #6
0
        public List<UserLevelsBO> LoadActiveUserLevels()
        {
            DBEgine dbEgine = new DBEgine();
            List<UserLevelsBO> userLevelsList = new List<UserLevelsBO>();

            try
            {

                dbEgine.DBOpen();

                SqlDataReader drUserLevels = dbEgine.ExecuteReader("UserManagement.UM_LoadActiveUserLevels", null);
                if (drUserLevels != null && drUserLevels.HasRows)
                {
                    while (drUserLevels.Read())
                    {
                        UserLevelsBO userLevelObj = new UserLevelsBO();
                        userLevelObj = FillUserLevel(drUserLevels);

                        userLevelsList.Add(userLevelObj);
                    }

                }
                return userLevelsList;

            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #7
0
        public List<ScreenFunctionsBO> LoadGrantedScreenFunctionsbyScreenIDandUserName(int screenId, string userName)
        {
            DBEgine dbEgine = new DBEgine();

            List<ScreenBO> screenList = new List<ScreenBO>();

            try
            {
                dbEgine.DBOpen();

                SqlParameter[] parms = new SqlParameter[2];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "UserName";
                p1.SqlDbType = SqlDbType.NVarChar;
                p1.Size = 256;
                p1.Direction = ParameterDirection.Input;
                p1.Value = userName;
                parms[0] = p1;

                SqlParameter p2 = new SqlParameter();
                p2.ParameterName = "ScreenId";
                p2.SqlDbType = SqlDbType.Int;
                p2.Direction = ParameterDirection.Input;
                p2.Value = screenId;
                parms[1] = p2;

                SqlDataReader drScreenFunctionList = dbEgine.ExecuteReader("UM_LoadGrantedScreenFunctionsbyScreenIDandUserName", parms);

                List<ScreenFunctionsBO> screenFunctionsList = new List<ScreenFunctionsBO>();

                while (drScreenFunctionList.Read())
                {
                    ScreenFunctionsBO screenFunction = new ScreenFunctionsBO();

                    screenFunction.ScreenFunctionCode = drScreenFunctionList.GetValue(drScreenFunctionList.GetOrdinal("ScreenFunctionCode")).ToString();
                    screenFunction.FunctionName = drScreenFunctionList.GetValue(drScreenFunctionList.GetOrdinal("FunctionName")).ToString();
                    screenFunction.IsActive = drScreenFunctionList.GetBoolean(drScreenFunctionList.GetOrdinal("IsActive"));
                    screenFunction.IsGranted = drScreenFunctionList.GetBoolean(drScreenFunctionList.GetOrdinal("IsGranted"));

                    screenFunctionsList.Add(screenFunction);

                }

                dbEgine.DBClose();

                return screenFunctionsList;

            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #8
0
        public List<ScreenBO> LoadGrantedScreensByRoleID(int roleId)
        {
            DBEgine dbEgine = new DBEgine();

            List<ScreenBO> screenList = new List<ScreenBO>();

            try
            {
                dbEgine.DBOpen();

                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "@RoleId";
                p1.SqlDbType = SqlDbType.Int;
                p1.Direction = ParameterDirection.Input;
                p1.Value = roleId;
                parms[0] = p1;

                SqlDataReader drScreenList = dbEgine.ExecuteReader("UserManagement.UM_LoadGrantedScreensByRoleID", parms);

                while (drScreenList.Read())
                {
                    ScreenBO objscreen = new ScreenBO();

                    objscreen.ScreenId = drScreenList.GetInt32(drScreenList.GetOrdinal("ScreenId"));
                    objscreen.ScreenName = drScreenList.GetValue(drScreenList.GetOrdinal("Screen")).ToString();
                    objscreen.Url = drScreenList.GetValue(drScreenList.GetOrdinal("URL")).ToString();
                    objscreen.ScreenParentId = drScreenList.GetInt32(drScreenList.GetOrdinal("ScreenParentId"));
                    objscreen.IsMenu = drScreenList.GetBoolean(drScreenList.GetOrdinal("IsMenu"));
                    objscreen.IsEnable = drScreenList.GetBoolean(drScreenList.GetOrdinal("IsEnable"));
                    objscreen.ScreenOrderId = drScreenList.GetInt32(drScreenList.GetOrdinal("ScreenOrderId"));

                    List<ScreenFunctionsBO> listScreenFuntions = new ScreenFunctionsDAL().LoadScreenFunctions(objscreen.ScreenId, roleId);

                    objscreen.ScreenFunctions = new List<ScreenFunctionsBO>();

                    if (listScreenFuntions != null && listScreenFuntions.Count > 0)
                    {
                        objscreen.ScreenFunctions = listScreenFuntions;
                    }

                    screenList.Add(objscreen);

                }
                dbEgine.DBClose();

                return screenList;
            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #9
0
        public List<UserRolesBO> LoadUserRolesByUserName(string UserName, string Password)
        {
            DBEgine dbEgine = new DBEgine();
            List<UserRolesBO> userRoleList = new List<UserRolesBO>();

            try
            {

                dbEgine.DBOpen();
                SqlParameter[] parms = new SqlParameter[2];

                SqlParameter userNameParm = new SqlParameter();
                userNameParm.ParameterName = "@UserName";
                userNameParm.SqlDbType = SqlDbType.NVarChar;
                userNameParm.Direction = ParameterDirection.Input;
                userNameParm.Value = UserName;
                parms[0] = userNameParm;

                SqlParameter passwordParm = new SqlParameter();
                passwordParm.ParameterName = "@password";
                passwordParm.SqlDbType = SqlDbType.VarChar;
                passwordParm.Direction = ParameterDirection.Input;
                passwordParm.Value = Password;
                parms[1] = passwordParm;

                SqlDataReader drUserRoles = dbEgine.ExecuteReader("UM_LoadUserRolesByUserName", parms);
                if (drUserRoles != null && drUserRoles.HasRows)
                {
                    while (drUserRoles.Read())
                    {
                        UserRolesBO userRoleObj = new UserRolesBO();
                        userRoleObj.UserRoleName = drUserRoles.GetValue(drUserRoles.GetOrdinal("UserRoleName")).ToString();

                        userRoleList.Add(userRoleObj);
                    }

                }
                return userRoleList;

            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #10
0
        public List<SubItemDetailBO> GetSubItemDetailBySubItemID(int id)
        {
            DBEgine objDbAccess = new DBEgine();
            var list = new List<SubItemDetailBO>();
            try
            {
                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter parmItemID = new SqlParameter();
                parmItemID.Value = id;
                parmItemID.SqlDbType = SqlDbType.Int;
                parmItemID.Direction = ParameterDirection.Input;
                parmItemID.ParameterName = "@SubItemID";
                parms[0] = parmItemID;

                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("Inventory.GetSubItemDetailBySubItemID", parms);

                while (dr.Read())
                {
                    var subItemDetail = new SubItemDetailBO();

                    subItemDetail.SubItemID = int.Parse(dr["SubItemID"].ToString());
                    subItemDetail.Serial = dr["ItemSerial"].ToString();
                    subItemDetail.UnitOfMeasureID = int.Parse(dr["UnitOfMeasureID"].ToString());
                    subItemDetail.SubItemDetailID = int.Parse(dr["SubItemDetailID"].ToString());
                    subItemDetail.ItemID = int.Parse(dr["ItemID"].ToString());
                    subItemDetail.QtyForUnit = decimal.Parse(dr["QtyForUnit"].ToString());
                    subItemDetail.Description = dr["ItemDescription"].ToString();
                    subItemDetail.UnitOfMeasureName = dr["UnitDescription"].ToString();

                    list.Add(subItemDetail);

                }
                return list;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
예제 #11
0
        public static List<DesignationBO> GetAllDesignations(bool IsActive)
        {
            List<DesignationBO> DesignationList = new List<DesignationBO>();

            DBEgine dbEgine = new DBEgine();

            try
            {

                dbEgine.DBOpen();
                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "@IsActive";
                p1.SqlDbType = SqlDbType.Bit;
                p1.Direction = ParameterDirection.Input;
                p1.Value = IsActive;
                parms[0] = p1;

                SqlDataReader drDesig = dbEgine.ExecuteReader("UM_GetAllDesignations", parms);
                if (drDesig != null && drDesig.HasRows)
                {

                    while (drDesig.Read())
                    {
                        DesignationDAL des = new DesignationDAL();
                        DesignationList.Add(des.FillDesignation(drDesig));

                    }

                }
                return DesignationList;
            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #12
0
        public DesignationBO GetDesignation(int Id)
        {
            DBEgine dbEgine = new DBEgine();
            DesignationBO des = new DesignationBO();
            try
            {

                dbEgine.DBOpen();
                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "in_DesignationId";
                p1.SqlDbType = SqlDbType.Int;
                p1.Direction = ParameterDirection.Input;
                p1.Value = Id;
                parms[0] = p1;

                SqlDataReader drDesig = dbEgine.ExecuteReader("UserManagement.UM_LoadDesignationById", parms);
                if (drDesig != null && drDesig.HasRows)
                {

                    while (drDesig.Read())
                    {
                        des= FillDesignation(drDesig);
                    }

                   // this.ScreenList = LoadUserPermissionByUserId();

                }
                return des;
            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #13
0
        public List<UserUnlockBO> LoadUserLockHistory(int UserId)
        {
            DBEgine dbEgine = new DBEgine();

               List<UserUnlockBO> LockList = new List<UserUnlockBO>();

               try
               {
                    dbEgine.DBOpen();

                    SqlParameter[] parms = new SqlParameter[1];

                    SqlParameter p1 = new SqlParameter();
                    p1.ParameterName = "@UserId";
                    p1.SqlDbType = SqlDbType.Int;
                    p1.Direction = ParameterDirection.Input;
                    p1.Value = UserId;
                    parms[0] = p1;

                    SqlDataReader drUser = dbEgine.ExecuteReader("UM_LoadUserLockHistory", parms);

                    LockList = FillUserUnlockInformation(drUser);

                    if (LockList != null)
                    {
                        return LockList;
                    }

                    return null;
               }

               catch
               {
                   throw;
               }
               finally
               {
                   dbEgine.DBClose();
               }
        }
예제 #14
0
        public List<UserBO> LoadActiveAccountManagers()
        {
            List<UserBO> listActiveAccountManagers = new List<UserBO>();

            DBEgine dbEngine = new DBEgine();
            try
            {
                dbEngine.DBOpen();
                SqlDataReader sqlDataReader = dbEngine.ExecuteReader("UM_LoadActiveAccountManagers", null);
                while (sqlDataReader.Read())
                {
                    UserBO user = new UserBO();

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("UserName")))
                    {
                        user.UserName = sqlDataReader.GetString(sqlDataReader.GetOrdinal("UserName"));
                    }

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("FirstName")))
                    {
                        user.FirstName = sqlDataReader.GetString(sqlDataReader.GetOrdinal("FirstName"));
                    }

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("LastName")))
                    {
                        user.LastName = sqlDataReader.GetString(sqlDataReader.GetOrdinal("LastName"));
                    }

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("Nic")))
                    {
                        user.Nic = sqlDataReader.GetString(sqlDataReader.GetOrdinal("Nic"));
                    }

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("PassportNo")))
                    {
                        user.PassportNo = sqlDataReader.GetString(sqlDataReader.GetOrdinal("PassportNo"));
                    }

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("EmployeeNo")))
                    {
                        user.EmpNo = sqlDataReader.GetString(sqlDataReader.GetOrdinal("EmployeeNo"));
                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("DesignationId")))
                    {
                        user.UserDesignation = new DesignationBO();
                        user.UserDesignation.DesignationId = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("DesignationId"));
                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("UserId")))
                    {
                        user.UserId = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("UserId"));
                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("IsEnable")))
                    {
                        user.IsEnable = sqlDataReader.GetBoolean(sqlDataReader.GetOrdinal("IsEnable"));
                    }

                    listActiveAccountManagers.Add(user);

                }
            }
            catch
            {
                throw;
            }
            finally
            {
                dbEngine.DBClose();
            }
            return listActiveAccountManagers;
        }
예제 #15
0
        public List<InvoiceLookUp> LoadAllInvoicesForLookUp()
        {
            DBEgine objDbAccess = new DBEgine();
            var list = new List<InvoiceLookUp>();
            try
            {

                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("Sales.GetInvoiceDetailsLookUp", null);

                while (dr.Read())
                {
                    var invoice = new InvoiceLookUp();

                    invoice.InvoiceID = int.Parse(dr["InvoiceID"].ToString());
                    invoice.InvoiceNumber = dr["InvoiceNumber"].ToString();
                    invoice.Status = dr["Status"].ToString();
                    invoice.Total = Convert.ToDecimal(dr["Total"].ToString());

                    list.Add(invoice);
                }

                return list;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
예제 #16
0
        public List<InvoiceDetailBO> GetInvoiceDetailByInvoiceID(int invoiceID)
        {
            DBEgine objDbAccess = new DBEgine();
            var list = new List<InvoiceDetailBO>();
            try
            {
                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter parmItemID = new SqlParameter();
                parmItemID.Value = invoiceID;
                parmItemID.SqlDbType = SqlDbType.Int;
                parmItemID.Direction = ParameterDirection.Input;
                parmItemID.ParameterName = "@InvoiceID";
                parms[0] = parmItemID;

                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("Sales.GetInvoiceDetailByInvoiceID", parms);

                while (dr.Read())
                {
                    var invoiceDetailBO = new InvoiceDetailBO();

                    invoiceDetailBO.InvoiceDetailId = int.Parse(dr["InvoiceDetailID"].ToString());
                    invoiceDetailBO.InvoiceId = int.Parse(dr["InvoiceID"].ToString());
                    invoiceDetailBO.ItemId = int.Parse(dr["ItemID"].ToString());
                    invoiceDetailBO.Quantity = decimal.Parse(dr["Qty"].ToString());
                    invoiceDetailBO.SubTotal = decimal.Parse(dr["SubTotal"].ToString());
                    invoiceDetailBO.ItemSerial = dr["SubItemSerial"].ToString();
                    invoiceDetailBO.ItemDescription = dr["SubItemDescription"].ToString();

                    list.Add(invoiceDetailBO);

                }
                return list;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
        public List<UserBranchesDetailsBO> LoadAllUserBranchesByUserID(int userId)
        {
            List<UserBranchesDetailsBO> userBranchesList=new List<UserBranchesDetailsBO>();
                UserBranchesDetailsBO userBranch = new UserBranchesDetailsBO();
                DBEgine dbEgine = new DBEgine();
                try{

                        SqlParameter[] parms = new SqlParameter[1];

                        SqlParameter p1 = new SqlParameter();
                        p1.ParameterName = "UserID";
                        p1.SqlDbType = SqlDbType.Int;
                        p1.Direction = ParameterDirection.Input;
                        p1.Value = userId;
                        parms[0] = p1;

                        dbEgine.DBOpen();
                        SqlDataReader drUserBranches = dbEgine.ExecuteReader("UserManagement.UM_LoadUserBranchesByUserID", parms);
                        if (drUserBranches != null && drUserBranches.HasRows )
                        {
                           while(drUserBranches.Read()){
                               userBranch=FillUserBranches(drUserBranches);
                               userBranchesList.Add(userBranch);
                           }
                        }

                    return userBranchesList;
                }
                catch{
                 throw;
                }
                finally{
                  dbEgine.DBClose();
                }
        }
        public UserBranchesDetailsBO LoadUserBrancheByUserIDANDBranchID(int userId,int branchId)
        {
            List<UserBranchesDetailsBO> userBranchesList = new List<UserBranchesDetailsBO>();
                UserBranchesDetailsBO userBranch = new UserBranchesDetailsBO();
                DBEgine dbEgine = new DBEgine();
                try
                {

                    SqlParameter[] parms = new SqlParameter[2];

                    SqlParameter p1 = new SqlParameter();
                    p1.ParameterName = "UserID";
                    p1.SqlDbType = SqlDbType.Int;
                    p1.Direction = ParameterDirection.Input;
                    p1.Value = userId;
                    parms[0] = p1;

                    SqlParameter p2 = new SqlParameter();
                    p2.ParameterName = "BranchID";
                    p2.SqlDbType = SqlDbType.Int;
                    p2.Direction = ParameterDirection.Input;
                    p2.Value = branchId;
                    parms[1] = p2;

                    dbEgine.DBOpen();
                    SqlDataReader drUserBranches = dbEgine.ExecuteReader("UserManagement.UM_LoadUserBranchByUserIDANDBranchID", parms);
                    if (drUserBranches != null && drUserBranches.HasRows && drUserBranches.Read())
                    {
                        userBranch = FillUserBranches(drUserBranches);
                    }

                    return userBranch;
                }
                catch
                {
                    throw;
                }
                finally
                {
                    dbEgine.DBClose();
                }
        }
예제 #19
0
        public List<UserBO> LoadAllActiveUserByBranchID(int branchID)
        {
            DBEgine dbEgine = new DBEgine();

            List<UserBO> userList = new List<UserBO>();

            try
            {

                dbEgine.DBOpen();

                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "@BranchID";
                p1.SqlDbType = SqlDbType.Int;
                p1.Direction = ParameterDirection.Input;
                p1.Value = branchID;
                parms[0] = p1;

                SqlDataReader userReader = dbEgine.ExecuteReader("UM_LoadAllActiveUserByBranchID", parms);
                while (userReader.Read())
                {
                    UserBO user = new UserBO();

                    user.FirstName = userReader.GetValue(userReader.GetOrdinal("FirstName")).ToString();
                    user.LastName = userReader.GetValue(userReader.GetOrdinal("LastName")).ToString();
                    user.UserId = userReader.GetInt32(userReader.GetOrdinal("UserId"));
                    userList.Add(user);

                }
                return userList;
            }

            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #20
0
        public List<UserSessionBO> SearchUserSession(int BranchId, DateTime FromDate, DateTime ToDate, int LoginStatus)
        {
            List<UserSessionBO> listUserSessionDetail = new List<UserSessionBO>();
            DBEgine dbEngine = new DBEgine();
            try
            {

                dbEngine.DBOpen();

                SqlParameter[] arrSqlParam = new SqlParameter[4];

                SqlParameter pBranchID = new SqlParameter();
                pBranchID.ParameterName = "@branchId";
                pBranchID.SqlDbType = SqlDbType.Int;
                pBranchID.Value = BranchId;
                arrSqlParam[0] = pBranchID;

                SqlParameter pFromDate = new SqlParameter();
                pFromDate.ParameterName = "@FromDate";
                pFromDate.SqlDbType = SqlDbType.Date;
                pFromDate.Value = FromDate;
                arrSqlParam[1] = pFromDate;

                SqlParameter pToDate = new SqlParameter();
                pToDate.ParameterName = "@ToDate";
                pToDate.SqlDbType = SqlDbType.Date;
                pToDate.Value = ToDate;
                arrSqlParam[2] = pToDate;

                SqlParameter pLoginStatus = new SqlParameter();
                pLoginStatus.ParameterName = "@loginStatus";
                pLoginStatus.SqlDbType = SqlDbType.Int;
                pLoginStatus.Value = LoginStatus;
                arrSqlParam[3] = pLoginStatus;

                SqlDataReader sqlDataReader = dbEngine.ExecuteReader("UM_SearchUserSessionDetails", arrSqlParam);

                while (sqlDataReader.Read())
                {
                    UserSessionBO userSessionDetail = new UserSessionBO();

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("UserSessionID")))
                    {
                        userSessionDetail.UserSessionID = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("UserSessionID"));

                    }

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("UserID")))
                    {
                        userSessionDetail.UserID = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("UserID"));

                    }

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("UserName")))
                    {
                        userSessionDetail.UserName = sqlDataReader.GetString(sqlDataReader.GetOrdinal("UserName"));

                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("FullName")))
                    {
                        userSessionDetail.FullName = sqlDataReader.GetString(sqlDataReader.GetOrdinal("FullName"));

                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("BranchID")))
                    {
                        userSessionDetail.BranchID = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("BranchID"));

                    }

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("BranchName")))
                    {
                        userSessionDetail.BranchName = sqlDataReader.GetString(sqlDataReader.GetOrdinal("BranchName"));

                    }

                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("CreatedOn")))
                    {
                        userSessionDetail.CreatedOn = sqlDataReader.GetDateTime(sqlDataReader.GetOrdinal("CreatedOn"));

                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("LastAccessOn")))
                    {
                        userSessionDetail.LastAccessOn = sqlDataReader.GetDateTime(sqlDataReader.GetOrdinal("LastAccessOn"));

                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("IsLogout")))
                    {
                        userSessionDetail.IsLogout = sqlDataReader.GetBoolean(sqlDataReader.GetOrdinal("IsLogout"));

                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("LogoutType")))
                    {
                        userSessionDetail.LogoutType = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("LogoutType"));

                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("LogoutBy")))
                    {
                        userSessionDetail.LogoutBy = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("LogoutBy"));

                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("LogoutTime")))
                    {
                        userSessionDetail.LogoutTime = sqlDataReader.GetDateTime(sqlDataReader.GetOrdinal("LogoutTime"));

                    }
                    if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("Remark")))
                    {
                        userSessionDetail.Remark = sqlDataReader.GetString(sqlDataReader.GetOrdinal("Remark"));

                    }

                    listUserSessionDetail.Add(userSessionDetail);

                }

            }
            catch
            {
                throw;
            }
            finally
            {
                dbEngine.DBClose();
            }
            return listUserSessionDetail;
        }
예제 #21
0
        public List<UserBO> LoadBranchMobileUsers(int branchId)
        {
            DBEgine dbEngin = new DBEgine();
            try
            {
                SqlParameter branchIdParam = new SqlParameter("@BranchId", SqlDbType.Int);
                branchIdParam.Value = branchId;

                SqlParameter[] paramList = { branchIdParam };

                dbEngin.DBOpen();

                SqlDataReader reader = dbEngin.ExecuteReader("CB_LoadBranchMobileUsers", paramList);

                List<UserBO> userList = new List<UserBO>();

                while (reader.Read())
                {
                    UserBO user = new UserBO();
                    user.UserId = reader.GetInt32(reader.GetOrdinal("UserId"));
                    user.FirstName = reader.GetValue(reader.GetOrdinal("FirstName")).ToString();
                    user.LastName = reader.GetValue(reader.GetOrdinal("LastName")).ToString();

                    userList.Add(user);
                }

                return userList;
            }
            catch
            {
                throw;
            }
            finally
            {
                dbEngin.DBClose();
            }
        }
예제 #22
0
        public ItemBO GetItemByItemNo(string itemNo)
        {
            DBEgine objDbAccess = new DBEgine();
            var item = new ItemBO();
            try
            {

                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter parmItemID = new SqlParameter();
                parmItemID.Value = itemNo;
                parmItemID.SqlDbType = SqlDbType.VarChar;
                parmItemID.Direction = ParameterDirection.Input;
                parmItemID.ParameterName = "@ItemSerial";
                parms[0] = parmItemID;

                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("Inventory.GetItemByItemNo", parms);

                while (dr.Read())
                {
                    item.ItemID = int.Parse(dr["ItemID"].ToString());
                    item.ItemSerial = dr["ItemSerial"].ToString();
                    item.Description = dr["ItemDescription"].ToString();
                    item.UnitPrice = Convert.ToDecimal(dr["UnitPrice"].ToString());
                    item.MeasuringUnit = Convert.ToInt16(dr["MeasureUnit"].ToString());
                    item.QtyInHand = Convert.ToDecimal(dr["QtyInHand"].ToString());
                    item.BreakEven = Convert.ToDecimal(dr["BreakEven"].ToString());

                }

                return item;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
예제 #23
0
        public List<ItemBO> CheckInventory()
        {
            DBEgine objDbAccess = new DBEgine();
            var list= new List<ItemBO>();
            try
            {
                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("Inventory.CheckInventory", null);

                while (dr.Read())
                {
                    var item = new ItemBO();
                    item.ItemID = int.Parse(dr["ItemID"].ToString());
                    item.ItemSerial = dr["ItemSerial"].ToString();
                    item.Description = dr["ItemDescription"].ToString();
                    item.UnitPrice = Convert.ToDecimal(dr["UnitPrice"].ToString());
                    item.MeasuringUnit = Convert.ToInt16(dr["MeasureUnit"].ToString());
                    item.QtyInHand = Convert.ToDecimal(dr["QtyInHand"].ToString());
                    item.BreakEven = Convert.ToDecimal(dr["BreakEven"].ToString());

                    list.Add(item);

                }

                return list;

            }
            catch
            {
                throw;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
예제 #24
0
        public List<UserBO> LoadParticipantsBycampaignBranchId(int CampaignBranchAssignId)
        {
            DBEgine dbEgine = new DBEgine();

            List<UserBO> userList = new List<UserBO>();

            try
            {

                dbEgine.DBOpen();

                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "in_CampaignBranchAssignId";
                p1.SqlDbType = SqlDbType.Int;
                p1.Direction = ParameterDirection.Input;
                p1.Value = CampaignBranchAssignId;
                parms[0] = p1;

                SqlDataReader userReader = dbEgine.ExecuteReader("CM_LoadParticipantsBycampaignParticipantId", parms);
                while (userReader.Read())
                {
                    UserBO user = new UserBO();
                    //campaign.CampaignId = campaignReader.GetInt32(campaignReader.GetOrdinal("CampaignId"));
                    user.FirstName = userReader.GetValue(userReader.GetOrdinal("FirstName")).ToString();
                    user.LastName = userReader.GetValue(userReader.GetOrdinal("LastName")).ToString();
                    user.Initials = userReader.GetValue(userReader.GetOrdinal("Initials")).ToString();
                    user.Nic = userReader.GetValue(userReader.GetOrdinal("Nic")).ToString();
                    user.UserDesignation = new DesignationBO();
                    user.UserDesignation.DesignationId = userReader.GetInt32(userReader.GetOrdinal("DesignationId"));

                    user.UserDesignation = new DesignationDAL().GetDesignation(user.UserDesignation.DesignationId);

                    //user.UserDesignation.GetDesignation(user.UserDesignation.DesignationId);
                    user.Email = userReader.GetValue(userReader.GetOrdinal("Email")).ToString();
                    user.IsParticipate = userReader.GetBoolean(userReader.GetOrdinal("IsParticipate"));

                    //AD
                    //user.BranchPrimary = new Branch();
                    //user.BranchPrimary.BranchName = userReader.GetValue(userReader.GetOrdinal("BranchName")).ToString();

                    user.UserId = userReader.GetInt32(userReader.GetOrdinal("userId"));

                    user.CampaignParticipantsId = userReader.GetInt32(userReader.GetOrdinal("CampaignParticipantsId"));
                    user.IsEnable = userReader.GetBoolean(userReader.GetOrdinal("IsEnable"));

                    userList.Add(user);

                }
                return userList;
            }

            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #25
0
        public List<UserBO> LoadUserByDesignationID(int designationId)
        {
            DBEgine dbEgine = new DBEgine();

            List<UserBO> userList = new List<UserBO>();

            try
            {

                dbEgine.DBOpen();

                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "@DesignationID";
                p1.SqlDbType = SqlDbType.Int;
                p1.Direction = ParameterDirection.Input;
                p1.Value = designationId;
                parms[0] = p1;

                SqlDataReader userReader = dbEgine.ExecuteReader("UM_LoadUsersByDesignationID", parms);
                while (userReader.Read())
                {
                    UserBO user = new UserBO();

                    user.FirstName = userReader.GetValue(userReader.GetOrdinal("FirstName")).ToString();
                    user.LastName = userReader.GetValue(userReader.GetOrdinal("LastName")).ToString();
                    user.Initials = userReader.GetValue(userReader.GetOrdinal("Initials")).ToString();

                    user.UserDesignation = new DesignationBO();
                    user.UserDesignation.DesignationId = designationId;

                    user.UserDesignation = new DesignationDAL().GetDesignation(user.UserDesignation.DesignationId);

                    //user.UserDesignation.GetDesignation(user.UserDesignation.DesignationId);
                    user.IsEnable = userReader.GetBoolean(userReader.GetOrdinal("IsEnable"));
                    user.UserId = userReader.GetInt32(userReader.GetOrdinal("UserId"));
                    userList.Add(user);

                }
                return userList;
            }

            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #26
0
        public UserBO UserLoginForExternalDevices(string userName, string passWord)
        {
            DBEgine dbEgine = new DBEgine();
            UserBO user = new UserBO();
            try
            {

                dbEgine.DBOpen();
                SqlParameter[] parms = new SqlParameter[2];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "@UserName";
                p1.SqlDbType = SqlDbType.NVarChar;
                p1.Size = 256;
                p1.Direction = ParameterDirection.Input;
                p1.Value = userName;
                parms[0] = p1;

                SqlParameter p2 = new SqlParameter();
                p2.ParameterName = "@password";
                p2.SqlDbType = SqlDbType.NVarChar;
                p2.Size = 500;
                p2.Direction = ParameterDirection.Input;
                p2.Value = passWord;
                parms[1] = p2;

                SqlDataReader drUser = dbEgine.ExecuteReader("UserManagement.UM_LoadUserByUserNameandPassword", parms);
                if (drUser != null && drUser.HasRows)
                {
                    while (drUser.Read())
                    {
                        user = FillUser1(drUser);
                    }

                    //user.ScreenList = LoadUserPermissionByUserId();
                }
                else
                {
                    user = null;
                }

            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }

            return user;
        }
예제 #27
0
        public UserSessionBO GetActiveUserSessionBySessionID(UserSessionBO obj)
        {
            DBEgine dbEngine = new DBEgine();
            try
            {
                UserSessionBO us = null;

                dbEngine.DBOpen();
                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "UserSessionID";
                p1.SqlDbType = SqlDbType.UniqueIdentifier;
                p1.Value = obj.UserSessionID;
                parms[0] = p1;

                SqlDataReader sqlDr = dbEngine.ExecuteReader("UM_GetActiveUserSessionBySessionID", parms);

                if (sqlDr != null && sqlDr.HasRows)
                {
                    us = new UserSessionBO();
                    while (sqlDr.Read())
                    {
                        us = Fill(sqlDr);
                        UserSessionLastAccessUpdate(us);
                    }
                }

                return us;
            }
            catch
            {
                throw;
            }
            finally
            {
                dbEngine.DBClose();
            }
        }
예제 #28
0
        public List<UserLookUp> GetAllUsersForLookUp()
        {
            DBEgine dbEgine = new DBEgine();
            var list = new List<UserLookUp>();
            try
            {
                dbEgine.DBOpen();

                SqlDataReader drUser = dbEgine.ExecuteReader("UserManagement.GetUsersForLookUP", null);
                if (drUser != null && drUser.HasRows)
                {
                    while (drUser.Read())
                    {
                        var userLookUp = new UserLookUp();
                        userLookUp.UserId = drUser.GetInt32(drUser.GetOrdinal("UserId"));
                        userLookUp.UserName = drUser.GetValue(drUser.GetOrdinal("UserName")).ToString();
                        userLookUp.FirstName = drUser.GetValue(drUser.GetOrdinal("FirstName")).ToString();
                        userLookUp.LastName = drUser.GetValue(drUser.GetOrdinal("LastName")).ToString();
                        userLookUp.Email = drUser.GetValue(drUser.GetOrdinal("Email")).ToString();

                        list.Add(userLookUp);

                    }

                }
                return list;
            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
예제 #29
0
        public SubItemBO GetSubItemByID(int id)
        {
            DBEgine objDbAccess = new DBEgine();
            var subItem = new SubItemBO();
            try
            {
                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter parmItemID = new SqlParameter();
                parmItemID.Value = id;
                parmItemID.SqlDbType = SqlDbType.Int;
                parmItemID.Direction = ParameterDirection.Input;
                parmItemID.ParameterName = "@SubItemID";
                parms[0] = parmItemID;

                objDbAccess.DBOpen();

                SqlDataReader dr = objDbAccess.ExecuteReader("Inventory.GetAllSubItemByID", parms);

                while (dr.Read())
                {
                    subItem.SubItemID = int.Parse(dr["SubItemID"].ToString());
                    subItem.SubItemSerial = dr["SubItemSerial"].ToString();
                    subItem.SubItemDescription = dr["SubItemDescription"].ToString();
                    subItem.SubItemUnitPrice = Convert.ToDecimal(dr["SubItemUnitPrice"].ToString());
                    subItem.SubItemMeasureUnit = Convert.ToInt16(dr["SubItemMeasureUnit"].ToString());

                }
                return subItem;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
예제 #30
0
        public UserBO LoadUserByUserName(UserBO obj)
        {
            DBEgine dbEgine = new DBEgine();

            try
            {

                dbEgine.DBOpen();
                SqlParameter[] parms = new SqlParameter[1];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "@UserName";
                p1.SqlDbType = SqlDbType.NVarChar;
                p1.Size = 256;
                p1.Direction = ParameterDirection.Input;
                p1.Value = obj.UserName;
                parms[0] = p1;

                SqlDataReader drUser = dbEgine.ExecuteReader("UserManagement.UM_LoadUserByUserName", parms);
                if (drUser != null && drUser.HasRows)
                {
                    while (drUser.Read())
                    {
                       obj= FillUser(drUser);
                    }
                    obj.ScreenList = LoadUserPermissionByUserId(obj);

                }

            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
            return obj;
        }