Exemplo n.º 1
0
        private bool SendNotifyLetterMethod(HrUnitOfWork _hrUnitOfWork, string UserName, int EmpID, string ID, out string ErrorMessage)
        {
            ErrorMessage = "";

            int          CompanyID      = User.Identity.GetDefaultCompany();
            string       CurrentURL     = HttpContext.Request.Url.Authority;
            string       DownloadAPKUrl = System.Configuration.ConfigurationManager.AppSettings["DownloadAPKUrl"];
            DateTime     Today          = DateTime.Now.Date;
            string       Language       = HttpContext.User.Identity.GetLanguage();
            NotifyLetter NL             = new NotifyLetter()
            {
                CompanyId    = CompanyID,
                EmpId        = EmpID,
                NotifyDate   = Today,
                NotifySource = MsgUtils.Instance.Trls(Db.Persistence.Constants.Sources.UserProfile, Language),
                SourceId     = ID,
                Sent         = true,
                EventDate    = Today,
                Description  = MsgUtils.Instance.Trls("User Name", Language) + " : " + UserName + " " + MsgUtils.Instance.Trls("Website", Language) + " : " + CurrentURL + " " + MsgUtils.Instance.Trls("Download APK", Language) + " : " + DownloadAPKUrl
            };


            AddNotifyLetters AddNotifyLetters = new AddNotifyLetters(_hrUnitOfWork, NL, Language);
            bool             Result           = AddNotifyLetters.Run(out ErrorMessage);

            return(Result);
        }
Exemplo n.º 2
0
        public static bool ExtendContractMethod(IHrUnitOfWork unitofwork, string Language, out string ErrorMessage)
        {
            bool Result = false;

            ErrorMessage = "";
            try
            {
                // Get All employees The will Send Email to whose contract Finish and before No of days
                var Employments = unitofwork.EmployeeRepository.SendMailEmployees();

                List <NotifyLetter> NotifyLettersList = new List <NotifyLetter>();
                foreach (var item in Employments)
                {
                    string NotifySource = "", Description = "";
                    if (item.Renew)
                    {
                        NotifySource = Constants.Sources.RenewContract;
                        Description  = MsgUtils.Instance.Trls("Contract has been renewed", Language);
                    }
                    else
                    {
                        NotifySource = Constants.Sources.ContractFinish;
                        Description  = MsgUtils.Instance.Trls("Contract has been finished", Language);
                    }

                    bool IsSentBefore = unitofwork.NotifyLetterRepository.IsNotificationSent(item.EmpId, DateTime.Today.Date, NotifySource);

                    if (!IsSentBefore)
                    {
                        NotifyLetter NL = new NotifyLetter()
                        {
                            CompanyId    = item.CompanyId,
                            EmpId        = item.EmpId,
                            NotifyDate   = DateTime.Today,
                            NotifySource = NotifySource,
                            SourceId     = item.Id.ToString(),
                            Sent         = false,
                            EventDate    = item.EndDate,
                            Description  = Description
                        };

                        NotifyLettersList.Add(NL);
                        //unitofwork.NotifyLetterRepository.Add(NL);
                    }
                }
                string           DefaultErrorMessage = MsgUtils.Instance.Trls("NotifyLetterNotSent", Language);
                AddNotifyLetters AddNotifyLetters    = new AddNotifyLetters(unitofwork, NotifyLettersList, Language);
                Result = AddNotifyLetters.Run(out ErrorMessage, DefaultErrorMessage);
            }
            catch
            {
            }
            return(Result);
        }