Example #1
0
        public LoginHelper SearchLocation(string unitCode)
        {
            RASolarERPData erpDal = new RASolarERPData();

            LoginHelper objLoginHelper = new LoginHelper();

            //Common_UnitInfo objUnit = new Common_UnitInfo();
            //objUnit = erpDal.Unit(unitCode);

            LocationInfo objUnit = new LocationInfo();

            objUnit = erpDal.Location(unitCode);

            //Common_RegionInfo objRegion = new Common_RegionInfo();
            //objRegion = erpDal.Region(objUnit.Reg_Code);

            LocationInfo objRegion = new LocationInfo();

            objRegion = erpDal.Location(objUnit.ParentLocationCode);

            //Common_ZoneInfo objZone = new Common_ZoneInfo();
            //objZone = erpDal.Zone(objRegion.Zone_Code);

            LocationInfo objZone = new LocationInfo();

            objZone = erpDal.Location(objRegion.ParentLocationCode);

            objLoginHelper.TopMenu       = "SiteMenu/UnitUserMenu";
            objLoginHelper.LocationTitle = "Location Type: ";
            objLoginHelper.ZoneTitle     = "Zone: ";
            objLoginHelper.RegionTitle   = "Region: ";
            objLoginHelper.UnitTitle     = "Unit: ";

            objLoginHelper.LogInForZoneCode   = objZone.LocationCode;
            objLoginHelper.LogInForZoneName   = objZone.LocationName;
            objLoginHelper.LogInForRegionCode = objRegion.LocationCode;
            objLoginHelper.LogInForRegionName = objRegion.LocationName;
            objLoginHelper.LogInForUnitCode   = objUnit.LocationCode;
            objLoginHelper.LogInForUnitName   = objUnit.LocationName + " [" + objUnit.LocationCode + "]";
            objLoginHelper.Location           = Helper.Unit;

            return(objLoginHelper);
        }
Example #2
0
        public LoginHelper LoginInformation(FormCollection fCollection, UserInformation objUserInfo)
        {
            try
            {
                LoginHelper userLoginInfo = new LoginHelper();

                userLoginInfo.LogInID = fCollection["txtUserName"].ToString().ToLower();

                userLoginInfo.LogInUserName = objUserInfo.UserName != null ? objUserInfo.UserName : "";

                if (userLoginInfo.LogInUserName != null)
                {
                    if (Helper.NumberOfCharacter(userLoginInfo.LogInUserName) > 20)
                    {
                        userLoginInfo.LogInUserName = objUserInfo.UserName.Substring(0, 19);
                    }
                }

                userLoginInfo.LogInPassword = fCollection["txtPassword"].ToString().ToLower();

                userLoginInfo.UerRoleOrGroupID = objUserInfo.UserRoleOrGroupID;

                userLoginInfo.YearMonthCurrent = Helper.YearMonthCurrent();
                userLoginInfo.AuditorYearMonth = Helper.YearMonthPrevious(Helper.OneMonthPrevious);

                ArrayList userLocationList = new ArrayList();
                userLocationList = RoleWiseLocation(objUserInfo);

                userLoginInfo.LogInForZoneCode   = userLocationList[0].ToString();
                userLoginInfo.LogInForZoneName   = userLocationList[1].ToString();
                userLoginInfo.LogInForRegionCode = userLocationList[2].ToString();
                userLoginInfo.LogInForRegionName = userLocationList[3].ToString();
                userLoginInfo.LogInForUnitCode   = userLocationList[4].ToString();
                userLoginInfo.LogInForUnitName   = userLocationList[5].ToString();
                userLoginInfo.Location           = userLocationList[6].ToString();

                userLoginInfo.CustomerPrefix = customerPrefix;

                userLoginInfo.HomeLocation = objUserInfo.OnlyForLocation;
                userLoginInfo.HomeURL      = HomeURL;

                userLoginInfo.LocationTitle = userLocationList[7].ToString();
                userLoginInfo.ZoneTitle     = userLocationList[8].ToString();
                userLoginInfo.RegionTitle   = userLocationList[9].ToString();
                userLoginInfo.UnitTitle     = userLocationList[10].ToString();

                userLoginInfo.ReportType           = reportType;
                userLoginInfo.URL                  = URL;
                userLoginInfo.URLSelectionLocation = URLSelectionLocation;
                userLoginInfo.TopMenu              = TopNav;

                userLoginInfo.LocationCode = Helper.LocationCode(userLoginInfo);
                userLoginInfo.LocationName = Helper.LocationName(userLoginInfo);

                Common_PeriodOpenClose objPeriodOpenClose = new Common_PeriodOpenClose();
                objPeriodOpenClose = erpService.ReadPeriodOpenClose(userLoginInfo.LocationCode);

                if (objPeriodOpenClose != null)
                {
                    userLoginInfo.TransactionOpenDate = objPeriodOpenClose.CalenderDate;
                }
                else
                {
                    userLoginInfo.TransactionOpenDate = new DateTime(1900, 1, 1);
                }

                LocationInfo objLocationInfo = new LocationInfo();
                objLocationInfo = erpService.Location(userLoginInfo.LocationCode);

                if (objLocationInfo != null)
                {
                    if (objLocationInfo.BackDayAllowedForTransaction != null)
                    {
                        if (objLocationInfo.BackDayAllowedForTransaction != 0)
                        {
                            DateTime transactionBackDate = objPeriodOpenClose.CalenderDate.AddDays((Convert.ToDouble(objLocationInfo.BackDayAllowedForTransaction) * -1)).Date;
                            userLoginInfo.TransactionBackDate = transactionBackDate;
                        }
                        else
                        {
                            userLoginInfo.TransactionBackDate = objPeriodOpenClose != null ? objPeriodOpenClose.CalenderDate : new DateTime(1900, 1, 1);
                        }
                    }
                    else
                    {
                        userLoginInfo.TransactionBackDate = objPeriodOpenClose != null ? objPeriodOpenClose.CalenderDate : new DateTime(1900, 1, 1);
                    }
                }
                else
                {
                    userLoginInfo.TransactionBackDate = objPeriodOpenClose != null ? objPeriodOpenClose.CalenderDate : new DateTime(1900, 1, 1);
                }

                Common_CurrentYearMonthNWeek objCurrenOpenYearMonthNWeek = erpService.ReadCurrentYearMonthNWeek();

                userLoginInfo.MonthOpenForSales                  = objCurrenOpenYearMonthNWeek.MonthOpenForSales;
                userLoginInfo.MonthOpenForInventory              = objCurrenOpenYearMonthNWeek.MonthOpenForInventory;
                userLoginInfo.MonthOpenForAccounting             = objCurrenOpenYearMonthNWeek.MonthOpenForAccounting;
                userLoginInfo.MonthOpenForHRMS                   = objCurrenOpenYearMonthNWeek.MonthOpenForHRMS;
                userLoginInfo.WeekOpenForWeeklyOverdueCollection = objCurrenOpenYearMonthNWeek.WeekOpenForWeeklyOverdueCollection;
                userLoginInfo.MonthOpenForDailyProgressReview    = objCurrenOpenYearMonthNWeek.MonthOpenForDailyProgressReview;

                DateTime openDateForWeek = Helper.YearWeekToStartDate(objCurrenOpenYearMonthNWeek.WeekOpenForWeeklyOverdueCollection);
                userLoginInfo.OpenYearWeek        = Helper.YearWeek(openDateForWeek);
                userLoginInfo.OpenWeekNumber      = Helper.CurrentWeekOfYear(openDateForWeek);
                userLoginInfo.FirstDateOfOpenWeek = Helper.FirstDateOfCurrentWeek(openDateForWeek);
                userLoginInfo.LastDateOfOpenWeek  = Helper.LastDateOfCurrentWeek(openDateForWeek);

                DateTime currentDate = DateTime.Now.Date;
                userLoginInfo.CurrentYearWeek        = Helper.YearWeek(currentDate);
                userLoginInfo.CurrentWeekNumber      = Helper.CurrentWeekOfYear(currentDate);
                userLoginInfo.FirstDateOfCurrentWeek = Helper.FirstDateOfCurrentWeek(currentDate);
                userLoginInfo.LastDateOfCurrentWeek  = Helper.LastDateOfCurrentWeek(currentDate);

                userLoginInfo.ModluleTitle = modluleTitle;
                userLoginInfo.OfficeModule = officeModule;

                userLoginInfo.IsAuthenticApproverForThisLocation = objUserInfo.IsAuthenticApproverForThisLocation != null?Convert.ToBoolean(objUserInfo.IsAuthenticApproverForThisLocation) : false;

                userLoginInfo.IsInventoryImplemented = isInventoryImplemented;

                return(userLoginInfo);
            }
            catch (Exception ex)
            {
                throw;
            }
        }