Пример #1
0
 internal SMSLogsBLL MapSMSLog(SMSLogs SMSLog)
 {
     try
     {
         SMSLogsBLL SMSLogBLL = null;
         if (SMSLog != null)
         {
             SMSLogBLL = new SMSLogsBLL()
             {
                 SMSLogID           = SMSLog.SMSLogID,
                 BusinssSubCategory = (BusinessSubCategoriesEnum)SMSLog.BusinssSubCategoryID,
                 DetailID           = DetailID,
                 Message            = Message,
                 MobileNo           = MobileNo,
                 CreatedDate        = CreatedDate,
                 CreatedBy          = CreatedBy
             };
         }
         return(SMSLogBLL);
     }
     catch
     {
         throw;
     }
 }
Пример #2
0
        public bool SendSMS(SMSLogsBLL SMSLog, bool IsLog = true)
        {
            try
            {
                //string resourceAddress = "SMS/SendSingleSMS";
                string MobileNo = FormatMobileNum(SMSLog.MobileNo);

                if (!string.IsNullOrEmpty(MobileNo))
                {
                    if (Utilities.IsProEnv() || Utilities.IsTestEnv())
                    {
                        if (Utilities.IsTestEnv())
                        {
                            SMSLog.Message = SMSLog.Message + " - " + Globalization.TestTrialText;
                        }

                        SMS PostSendingDTO = new SMS()
                        {
                            Message  = SMSLog.Message.Replace("<br/>", Environment.NewLine),
                            MobileNo = MobileNo,
                            Password = Password,
                            UserName = UserName
                        };

                        var PostTask = client.PostAsJsonAsync("SMS/SendSingleSMS", PostSendingDTO).Result;

                        if (PostTask.IsSuccessStatusCode)
                        {
                            if (IsLog)
                            {
                                SMSLog.Add();
                            }

                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        private void SendSMS(ExpensesBLL Expense)
        {
            SMSLogsBLL smslog = new SMSLogsBLL()
            {
                CreatedDate = DateTime.Now,
                CreatedBy   = new EmployeesCodesBLL()
                {
                    EmployeeCodeID = Expense.ApprovedBy.Value
                }
            };


            if (this.GetType() == typeof(BaseDelegationsBLL))
            {
                BaseDelegationsBLL Delegation = (BaseDelegationsBLL)Expense;
                smslog.DetailID           = Delegation.DelegationID;
                smslog.BusinssSubCategory = BusinessSubCategoriesEnum.Delegations;
                if (!Expense.IsApproved)
                {
                    smslog.Message = string.Format(Globalization.SMSDelegationApprovalMessageText, Delegation.DelegationStartDate.ToShortDateString(), Delegation.DelegationPeriod);
                }
                else if (Expense.IsApproved)
                {
                    smslog.Message = string.Format(Globalization.SMSDelegationApprovalCancelMessageText, Delegation.DelegationStartDate.ToShortDateString(), Delegation.DelegationPeriod);
                }
                foreach (DelegationsDetailsBLL dd in Delegation.DelegationsDetails)
                {
                    smslog.MobileNo = dd.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeMobileNo;
                    new SMSBLL().SendSMS(smslog);
                }
            }

            if (this.GetType() == typeof(OverTimesBLL))
            {
                OverTimesBLL OverTime = (OverTimesBLL)Expense;
                smslog.DetailID           = OverTime.OverTimeID;
                smslog.BusinssSubCategory = BusinessSubCategoriesEnum.OverTimes;
                if (!Expense.IsApproved)
                {
                    smslog.Message = string.Format(Globalization.SMSOverTimeApprovalMessageText, OverTime.OverTimeStartDate.ToShortDateString(), OverTime.OverTimePeriod);
                }
                else if (Expense.IsApproved)
                {
                    smslog.Message = string.Format(Globalization.SMSOverTimeApprovalCancelMessageText, OverTime.OverTimeStartDate.ToShortDateString(), OverTime.OverTimePeriod);
                }
                foreach (OverTimesDetailsBLL dd in OverTime.OverTimesDetails)
                {
                    smslog.MobileNo = dd.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeMobileNo;
                    new SMSBLL().SendSMS(smslog);
                }
            }
        }
Пример #4
0
        public bool SendMessage(BusinessSubCategoriesEnum BusinessSubCategory, string Message, string EmployeeMobileNo)
        {
            SMSLogsBLL SmsLogBLL = new SMSLogsBLL()
            {
                BusinssSubCategory = BusinessSubCategory,
                MobileNo           = EmployeeMobileNo,
                DetailID           = 0,
                Message            = Message,
                CreatedBy          = this.LoginIdentity,
                CreatedDate        = DateTime.Now,
            };

            SMSBLL SmsLog = new SMSBLL();
            bool   IsSent = SmsLog.SendSMS(SmsLogBLL);

            return(IsSent);
        }
Пример #5
0
        public Result RemoveEmployeeFromManager()
        {
            try
            {
                Result result = null;

                #region Validate if the Placement period finished or not
                result = CommonHelper.IsValidToCompleteEmployeesPlacement();
                if (result != null)
                {
                    return(result);
                }
                #endregion

                Assignings Assigning = new AssigningsDAL().GetByAssigningID(this.AssigningID);
                new AssigningsDAL().Delete(this.AssigningID, this.LoginIdentity.EmployeeCodeID);

                if (Assigning != null)
                {
                    SMSLogsBLL SMSLogBLL = new SMSLogsBLL()
                    {
                        BusinssSubCategory = BusinessSubCategoriesEnum.OrganizationStructure,
                        MobileNo           = Assigning.EmployeesCareersHistory.EmployeesCodes.Employees.EmployeeMobileNo,
                        DetailID           = 0,
                        Message            = string.Format(Globalization.SMSEmployeeAlreadyRemovedFromOrganizationManagerMessageText, Assigning.EmployeesCareersHistory.EmployeesCodes.Employees.FirstNameAr + " " + Assigning.EmployeesCareersHistory.EmployeesCodes.Employees.LastNameAr, new OrganizationsStructuresBLL().GetOrganizationNameTillLastParentExceptPresident(Assigning.OrganizationID.Value)),
                        CreatedBy          = this.LoginIdentity,
                        CreatedDate        = DateTime.Now,
                    };
                    new SMSBLL().SendSMS(SMSLogBLL);
                }

                result            = new Result();
                result.EnumType   = typeof(AssigningsValidationEnum);
                result.EnumMember = AssigningsValidationEnum.Done.ToString();
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        /// <summary>
        /// Task # 255: Changing the manager of any organization must affect on e services authorization module
        ///  - removed validation of Is Placement period finished or not?
        ///
        /// </summary>
        /// <param name="Organization"></param>
        /// <returns></returns>
        public Result ChangeOrganizationManager(OrganizationsStructuresBLL Organization)
        {
            try
            {
                Result result = null;

                // Now there is no need for this condition, placement is open for all times.

                //#region Validate if the Placement period finished or not
                //result = CommonHelper.IsValidToCompleteEmployeesPlacement();
                //if (result != null)
                //    return result;
                //#endregion

                // TASK 255 (related) Changing the manager of any organization must affect on e services authorization module
                OrganizationsStructures OldOrganization = new OrganizationsStructuresDAL().GetByOrganizationID(Organization.OrganizationID);

                // TASK 330 (related) Checking the manager organization is going to be changed or not .. if the manager is not going to be changed, no need to do any action
                if (OldOrganization.ManagerCodeID.HasValue)
                {
                    if (Organization.OrganizationManager.EmployeeCodeID == OldOrganization.ManagerCodeID.Value) // thats mean the manager is not going to be changed
                    {
                        return(result);
                    }
                }

                OrganizationsStructures OrganizationStructure = new OrganizationsStructures()
                {
                    OrganizationID  = Organization.OrganizationID,
                    ManagerCodeID   = Organization.OrganizationManager != null ? Organization.OrganizationManager.EmployeeCodeID : (int?)null,
                    LastUpdatedDate = DateTime.Now,
                    LastUpdatedBy   = Organization.LoginIdentity.EmployeeCodeID
                };

                Assignings Assigning = new Assignings()
                {
                    OrganizationID  = Organization.OrganizationID,
                    ManagerCodeID   = Organization.OrganizationManager != null ? Organization.OrganizationManager.EmployeeCodeID : (int?)null,
                    LastUpdatedDate = DateTime.Now,
                    LastUpdatedBy   = Organization.LoginIdentity.EmployeeCodeID
                };

                new OrganizationsStructuresDAL().UpdateManager(OrganizationStructure);
                new AssigningsDAL().UpdateOrganizationManager(Assigning); // if the manager of organization has been changed, the manager of the same organization in Assigning must be changed (for all unfinished assignings)

                // Old and New Organization must have ManagerCodeID
                // Update AuthorizedPerson in EServices Authorization table (related to task 255)
                if (OldOrganization.ManagerCodeID.HasValue && OldOrganization.ManagerCodeID.Value > 0 &&
                    Organization.OrganizationManager != null && Organization.OrganizationManager.EmployeeCodeID > 0)
                {
                    new EServicesAuthorizationsBLL()
                    {
                        LoginIdentity = Organization.LoginIdentity
                    }.ChangeAuthorizedPersonForAllChildByOrganizationID(Organization.OrganizationID, OldOrganization.ManagerCodeID.Value, Organization.OrganizationManager.EmployeeCodeID);
                }

                #region Task 318: Service to Cancel EServicesProxies By System
                try
                {
                    result = new EServicesProxiesBLL()
                    {
                        LoginIdentity = Organization.LoginIdentity
                    }
                    .RevokeEServiceProxyByEmployeeCodeID(Organization.OrganizationManager.EmployeeCodeID, EServicesProxiesStatusEnum.CancelledBySystem, Globalization.EServiceProxyCancelledBySystemBecauseOfChangeManagerText);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                #endregion


                // this to get mobile no of manager
                EmployeesCodesBLL ManagerCodeBLL = new EmployeesCodesBLL().GetByEmployeeCodeID(Organization.OrganizationManager != null ? Organization.OrganizationManager.EmployeeCodeID : 0);
                if (ManagerCodeBLL != null)
                {
                    SMSLogsBLL SMSLogBLL = new SMSLogsBLL()
                    {
                        BusinssSubCategory = BusinessSubCategoriesEnum.OrganizationStructure,
                        MobileNo           = ManagerCodeBLL.Employee.EmployeeMobileNo,
                        DetailID           = 0,
                        Message            = string.Format(Globalization.SMSManagerAlreadyAssignedToOrganizationMessageText, ManagerCodeBLL.Employee.FirstNameAr + " " + ManagerCodeBLL.Employee.LastNameAr, Organization.GetOrganizationNameTillLastParentExceptPresident(Organization.OrganizationID)),
                        CreatedBy          = Organization.LoginIdentity,
                        CreatedDate        = DateTime.Now,
                    };
                    new SMSBLL().SendSMS(SMSLogBLL);
                }

                result            = new Result();
                result.Entity     = this;
                result.EnumType   = typeof(OrganizationStructureValidationEnum);
                result.EnumMember = OrganizationStructureValidationEnum.Done.ToString();
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #7
0
        public Result AssignEmployeeUnderManager()
        {
            try
            {
                Result result;
                //Result result = base.Add();
                //if (result != null)
                //    return result;

                //int EmployeeCodeID = this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID;
                //DateTime StartDate = this.AssigningStartDate;
                //DateTime EndDate = this.AssigningEndDate ?? DateTime.Now.Date;

                #region Validate if the placement period finished or not
                result = CommonHelper.IsValidToCompleteEmployeesPlacement();
                if (result != null)
                {
                    return(result);
                }
                #endregion

                #region Validate if the employee has active Assigning or not
                BaseAssigningsBLL ActiveEmployeeAssigning = new EmployeesCodesBLL().GetAssigningsByEmployeeCodeID(this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID).FirstOrDefault(x => x.IsFinished == false);
                if (ActiveEmployeeAssigning != null)
                {
                    result            = new Result();
                    result.Entity     = ActiveEmployeeAssigning;
                    result.EnumType   = typeof(AssigningsValidationEnum);
                    result.EnumMember = AssigningsValidationEnum.RejectedBecauseOfActivePreviousAssigning.ToString();
                    return(result);
                }
                #endregion


                AssigningsReasonsBLL AssigningReason = GetLastAssigningEndReasonsByEmployeeCodeID(this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID);
                Assignings           assigning       = new Assignings();
                assigning.AssigningTypID     = (int)AssigningsTypesEnum.Internal;
                assigning.AssigningReasonID  = AssigningReason != null ? AssigningReason.AssigningReasonID : (int)AssigningsReasonsEnum.BasedOnWorkNeeds;
                assigning.AssigningStartDate = DateTime.Now.Date;
                assigning.ManagerCodeID      = this.Manager.EmployeeCodeID;
                assigning.OrganizationID     = this.Organization.OrganizationID;
                assigning.JobID = this.Job.JobID;
                assigning.EmployeeCareerHistoryID = this.EmployeeCareerHistory?.EmployeeCareerHistoryID;
                assigning.CreatedBy   = this.LoginIdentity.EmployeeCodeID;
                assigning.CreatedDate = DateTime.Now;
                this.AssigningID      = new AssigningsDAL().Insert(assigning);

                if (this.AssigningID != 0)
                {
                    // this to get info of employee
                    EmployeesCodesBLL EmployeeCodeBLL = new EmployeesCodesBLL().GetByEmployeeCodeID(this.EmployeeCareerHistory.EmployeeCode != null ? this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID : 0);

                    // this to get info of manager
                    EmployeesCodesBLL ManagerCodeBLL = new EmployeesCodesBLL().GetByEmployeeCodeID(this.Manager.EmployeeCodeID);

                    if (EmployeeCodeBLL != null)
                    {
                        SMSLogsBLL SMSLogBLL = new SMSLogsBLL()
                        {
                            BusinssSubCategory = BusinessSubCategoriesEnum.OrganizationStructure,
                            MobileNo           = EmployeeCodeBLL.Employee.EmployeeMobileNo,
                            DetailID           = 0,
                            Message            = string.Format(Globalization.SMSEmployeeAlreadyAssignedUnderManagerMessageText, EmployeeCodeBLL.Employee.FirstNameAr + " " + EmployeeCodeBLL.Employee.LastNameAr, new OrganizationsStructuresBLL().GetOrganizationNameTillLastParentExceptPresident(this.Organization.OrganizationID), ManagerCodeBLL.Employee.EmployeeNameAr),
                            CreatedBy          = this.LoginIdentity,
                            CreatedDate        = DateTime.Now,
                        };
                        new SMSBLL().SendSMS(SMSLogBLL);
                    }

                    result            = new Result();
                    result.Entity     = this;
                    result.EnumType   = typeof(AssigningsValidationEnum);
                    result.EnumMember = AssigningsValidationEnum.Done.ToString();
                }

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