Пример #1
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();
            }
        }
Пример #2
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();
            }
        }
Пример #3
0
        public void DeactivateUsersessionByInterval(int interval)
        {
            DBEgine dbEngine = new DBEgine();
            try
            {

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

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "intervalSecond";
                p1.SqlDbType = SqlDbType.Int;
                p1.Value = interval;
                parms[0] = p1;

                dbEngine.ExecNonQueryStoredProc("UM_DeactivateUsersessionByInterval", parms);

            }
            catch
            {
                throw;
            }
            finally
            {
                dbEngine.DBClose();
            }
        }
Пример #4
0
        public DataSet Report_GetUserRoles(int branchId, string userIdList)
        {
            DBEgine dbEngin = new DBEgine ();
            try
            {
                string BranchId = branchId.ToString();
                SqlParameter branchIdParam = new SqlParameter("@BranchId", SqlDbType.VarChar,10);
                branchIdParam.Value = BranchId;

                SqlParameter userListParam = new SqlParameter("@userId", SqlDbType.VarChar, 800);
                userListParam.Value = userIdList;

                SqlParameter[] paramList = { branchIdParam, userListParam };

                dbEngin.DBOpen();

                return dbEngin.ExecuteDataSet("UM_Report_GerUserRoles", paramList);
            }
            catch
            {
                throw;
            }
            finally
            {
                dbEngin.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();
            }
        }
        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();
                }
        }
Пример #7
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();
            }
        }
Пример #8
0
        public bool DeleteSubItemByID(int id)
        {
            DBEgine objDbAccess = new DBEgine();
            bool result = false;
            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();

                int count = objDbAccess.ExecNonQueryStoredProc("Inventory.DeleteSubItem", parms);

               if (count > 0)
               {
                   result = true;
               }

                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
Пример #9
0
        public bool CompleteDayProcess(int user)
        {
            DBEgine objDbAccess = new DBEgine();
            bool result = false;
            try
            {
                objDbAccess.DBOpen();

                SqlParameter[] parms = new SqlParameter[1];

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

                objDbAccess.ExecNonQueryStoredProc("[admin].CompleteDayProcess ", parms);

                result = true;
                return result;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
        public UserPaswordHistoryBO GetCurrentPaswordDetails(DBEgine dbEngine,int userID)
        {
            UserPaswordHistoryBO hs = null;

            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;

                DataTable dtHistry = dbEngine.ExecuteDataTable("UserManagement.UM_GetCurrentPasswordDetails", parms);
                if (dtHistry.Rows.Count > 0)
                {

                    foreach (DataRow r in dtHistry.Rows)
                    {
                        hs = new UserPaswordHistoryBO();

                        if (r.Table.Columns.Contains("UserPaswordHistoryID"))
                            if (r["UserPaswordHistoryID"] != DBNull.Value)
                                hs.UserPaswordHistoryID = (int)r["UserPaswordHistoryID"];

                        if (r.Table.Columns.Contains("UserID"))
                            if (r["UserID"] != DBNull.Value)
                                hs.UserID = (int)r["UserID"];

                        if (r.Table.Columns.Contains("Password"))
                            if (r["Password"] != DBNull.Value)
                                hs.Password = r["Password"].ToString();

                        if (r.Table.Columns.Contains("CreatedBy"))
                            if (r["CreatedBy"] != DBNull.Value)
                                hs.CreatedBy = (int)r["CreatedBy"];

                        if (r.Table.Columns.Contains("CreatedDate"))
                            if (r["CreatedDate"] != DBNull.Value)
                                hs.CreatedDate = DateTime.Parse(r["CreatedDate"].ToString());

                        if (r.Table.Columns.Contains("DayProcessID"))
                            if (r["DayProcessID"] != DBNull.Value)
                                hs.DayProcessID = r["DayProcessID"].ToString();

                        if (r.Table.Columns.Contains("IsCurrent"))
                            if (r["IsCurrent"] != DBNull.Value)
                                hs.IsCurrent = (bool)r["IsCurrent"];
                    }

                }
                return hs;
            }
            catch
            {
                throw;
            }
        }
Пример #11
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();
            }
        }
Пример #12
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();
            }
        }
        public int AddUserBranchDetails(DBEgine dbEgine,int userId,UserBranchesDetailsBO obj)
        {
            try {
                    SqlParameter[] paramArray = new SqlParameter[3];

                    SqlParameter branchIDParam = new SqlParameter();
                    branchIDParam.ParameterName = "@BranchID";
                    branchIDParam.SqlDbType = SqlDbType.Int;
                    branchIDParam.Direction = ParameterDirection.Input;
                    branchIDParam.Value = obj.BranchID;
                    paramArray[0] = branchIDParam;

                    SqlParameter userIDParam = new SqlParameter();
                    userIDParam.ParameterName = "@UserID";
                    userIDParam.SqlDbType = SqlDbType.Int;
                    userIDParam.Direction = ParameterDirection.Input;
                    userIDParam.Value = obj.UserID;
                    paramArray[1] = userIDParam;

                    SqlParameter isPrimaryParam = new SqlParameter();
                    isPrimaryParam.ParameterName = "@IsPrimary";
                    isPrimaryParam.SqlDbType = SqlDbType.Bit;
                    isPrimaryParam.Direction = ParameterDirection.Input;
                    isPrimaryParam.Value = obj.IsPrimary;
                    paramArray[2] = isPrimaryParam;

                    dbEgine.ExecNonQueryStoredProc("UserManagement.UM_AddUserBranchesDetails", paramArray);
                    return obj.BranchID;
                }
                catch
                {
                    throw;
                }
        }
Пример #14
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();
            }
        }
Пример #15
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();
            }
        }
Пример #16
0
        public bool AddMeasurementUnit(MeasurementUnitBO measurementUnit)
        {
            DBEgine objDbAccess = new DBEgine();
            bool result = false;
            try
            {
                SqlParameter[] parms = new SqlParameter[4];

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

                SqlParameter parmUnitDescription = new SqlParameter();
                parmUnitDescription.Value = measurementUnit.UnitDescription;
                parmUnitDescription.SqlDbType = SqlDbType.VarChar;
                parmUnitDescription.Direction = ParameterDirection.Input;
                parmUnitDescription.ParameterName = "@UnitDescription";
                parms[1] = parmUnitDescription;

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

                SqlParameter parmCreatedUser = new SqlParameter();
                parmCreatedUser.Value = measurementUnit.CreatedUser;
                parmCreatedUser.SqlDbType = SqlDbType.Int;
                parmCreatedUser.Direction = ParameterDirection.Input;
                parmCreatedUser.ParameterName = "@CreatedUser";
                parms[3] = parmCreatedUser;

                objDbAccess.DBOpen();

                if (objDbAccess.ExecNonQueryStoredProc("Inventory.SaveMeasurementUnit", parms) > 0)
                {
                    result = true;
                }

                return result;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
Пример #17
0
        public static List<RelationshipBO> GetAllRelationship()
        {
            List<RelationshipBO> listRel = new List<RelationshipBO>();

            DBEgine dbEgine = new DBEgine();
            try
            {
                dbEgine.DBOpen();
                DataTable dt = dbEgine.ExecuteDataTable("U_GetAllRelationship", null);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow r in dt.Rows)
                    {
                        var relationshipBO = new RelationshipBO();

                        if (r["RelationShipID"] != DBNull.Value)
                            relationshipBO.RelationShipID = (int)r["RelationShipID"];

                        if (r["RelationShipName"] != DBNull.Value)
                            relationshipBO.RelationShipName = r["RelationShipName"].ToString();

                        if (r["IsActive"] != DBNull.Value)
                            relationshipBO.IsActive = (bool)r["IsActive"];

                        if (r["CreatedBy"] != DBNull.Value)
                            relationshipBO.CreatedBy = (int)r["CreatedBy"];

                        if (r["CreatedDate"] != DBNull.Value)
                            relationshipBO.CreatedDate = (DateTime)r["CreatedDate"];

                        if (r["ModifiedBy"] != DBNull.Value)
                            relationshipBO.ModifiedBy = (int)r["ModifiedBy"];

                        if (r["ModifiedDate"] != DBNull.Value)
                            relationshipBO.ModifiedDate = (DateTime)r["ModifiedDate"];

                        listRel.Add(relationshipBO);
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                dbEgine.DBClose();
            }

            return listRel;
        }
Пример #18
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();
            }
        }
        public int SaveUserPaswordHistory(DBEgine dbEngine, UserPaswordHistoryBO upHistry)
        {
            int ID = -1;
            try
            {
                SqlParameter[] arrSqlParam = GetFDUpLiftmentParameters(upHistry);
                dbEngine.ExecNonQueryStoredProc("UserManagement.UM_SaveUserPasswordHistory", arrSqlParam);

            }
            catch
            {
                throw;
            }

            return ID;
        }
Пример #20
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();
            }
        }
Пример #21
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();
            }
        }
Пример #22
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();
            }
        }
        public int DeleteUserBranchesDetails(DBEgine dbEgine, int userID)
        {
            try
                {
                    SqlParameter[] paramArray = new SqlParameter[1];

                    SqlParameter userIDParam = new SqlParameter();
                    userIDParam.ParameterName = "@UserID";
                    userIDParam.SqlDbType = SqlDbType.Int;
                    userIDParam.Direction = ParameterDirection.Input;
                    userIDParam.Value = userID;
                    paramArray[0] = userIDParam;

                    dbEgine.ExecNonQueryStoredProc("UserManagement.UM_DeleteUserBranchesDetails", paramArray);
                    return new UserBranchesDetailsBO().BranchID;
                }
                catch
                {
                    throw;
                }
        }
Пример #24
0
        public Guid CreateSession(UserSessionBO obj)
        {
            DBEgine dbEngine = new DBEgine();
            try
            {
                dbEngine.DBOpen();
                SqlParameter[] parms = new SqlParameter[3];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "UserId";
                p1.SqlDbType = SqlDbType.Int;
                p1.Value = obj.UserID;
                parms[0] = p1;

                SqlParameter p2 = new SqlParameter();
                p2.ParameterName = "LanguageID";
                p2.SqlDbType = SqlDbType.Int;
                p2.Value = obj.LanguageID;
                parms[1] = p2;

                SqlParameter p3 = new SqlParameter();
                p3.ParameterName = "UserSessionID";
                p3.SqlDbType = SqlDbType.UniqueIdentifier;
                p3.Direction = ParameterDirection.Output;
                parms[2] = p3;

                dbEngine.ExecNonQueryStoredProc("UM_CreateUserSession", parms);

                return (Guid)p3.Value;

            }
            catch
            {
                throw;
            }
            finally
            {
                dbEngine.DBClose();
            }
        }
Пример #25
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();
               }
        }
Пример #26
0
        public bool DeleteSubItemDetailByID(DBEgine objDbAccess, int id)
        {
            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.ExecNonQueryStoredProc("Inventory.DeleteSubItemDetail", parms);

                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #27
0
        public bool EditGroup(UserGroupBO obj)
        {
            bool isUpdate = false;

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

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

            SqlParameter p2 = new SqlParameter();
            p2.ParameterName = "in_groupName";
            p2.SqlDbType = SqlDbType.NVarChar;
            p2.Size = 50;
            p2.Direction = ParameterDirection.Input;
            p2.Value = obj.GroupName;
            parms[1] = p2;

            SqlParameter p3 = new SqlParameter();
            p3.ParameterName = "in_modifiedUser";
            p3.SqlDbType = SqlDbType.Int;
            p3.Direction = ParameterDirection.Input;
            p3.Value = obj.ModifiedUser;
            parms[2] = p3;

            dbEgine.ExecNonQueryStoredProc("UM_EditGroup", parms);
            isUpdate = true;

            dbEgine.DBClose();

            return isUpdate;
        }
Пример #28
0
        public bool DeleteInvoice(InvoiceHeaderBO invoiceHeader)
        {
            DBEgine objDbAccess = new DBEgine();
            bool result = false;
            SqlTransaction tran = null;
            try
            {
                SqlParameter[] parms = new SqlParameter[1];

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

                objDbAccess.DBOpen(tran);

                if (objDbAccess.ExecNonQueryStoredProc("Sales.DeleteInvoices", parms) > 0)
                {
                    result = true;
                }

                objDbAccess.DBTransAction.Commit();
                return result;

            }
            catch
            {
                objDbAccess.DBTransAction.Rollback();
                throw;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }
Пример #29
0
        public int SaveDesignation(out int Id, DesignationBO obj)
        {
            DBEgine dbEgine = new DBEgine();
            try
            {
                dbEgine.DBOpen();
                SqlParameter[] parms = new SqlParameter[4];

                SqlParameter designationIdParm = new SqlParameter();
                designationIdParm.ParameterName = "DesignationId";
                designationIdParm.SqlDbType = SqlDbType.Int;
                designationIdParm.Direction = ParameterDirection.InputOutput;
                designationIdParm.Value = obj.DesignationId;
                parms[0] = designationIdParm;

                SqlParameter designationParm = new SqlParameter();
                designationParm.ParameterName = "Designation";
                designationParm.SqlDbType = SqlDbType.NVarChar;
                designationParm.Direction = ParameterDirection.Input;
                designationParm.Value = obj.DesignationName;
                parms[1] = designationParm;

                SqlParameter descriptionParm = new SqlParameter();
                descriptionParm.ParameterName = "Description";
                descriptionParm.SqlDbType = SqlDbType.NVarChar;
                descriptionParm.Direction = ParameterDirection.Input;
                descriptionParm.Value = obj.Desciption;
                parms[2] = descriptionParm;

                SqlParameter IsActiveParm = new SqlParameter();
                IsActiveParm.ParameterName = "IsActive";
                IsActiveParm.SqlDbType = SqlDbType.Bit;
                IsActiveParm.Direction = ParameterDirection.Input;
                IsActiveParm.Value = obj.IsActive;
                parms[3] = IsActiveParm;

                dbEgine.ExecNonQueryStoredProc("UM_AddDesignations", parms);

                Id = Int32.Parse(designationIdParm.Value.ToString());
                return Id;
            }
            catch
            {
                throw;
            }
            finally
            {
                dbEgine.DBClose();
            }
        }
Пример #30
0
        public DataSet GetDailySalesReport(DateTime fromDate,DateTime toDate)
        {
            DBEgine objDbAccess = new DBEgine();
            try
            {
                objDbAccess.DBOpen();

                DataSet ds = objDbAccess.ExecuteDataSet("SELECT * FROM Sales.DailySales('"+fromDate.ToShortDateString()+"','"+toDate.ToShortDateString()+"')");

                return ds;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objDbAccess.DBClose();
            }
        }