Exemplo n.º 1
0
        private Setting GetSettingByCode(ETEMEnums.AppSettings appSettings)
        {

            Setting settings = AdminClientRef.GetSettingByCode(appSettings.ToString());

            return settings;

        }
Exemplo n.º 2
0
 public Dictionary<string, TableRow[]> LoadOfferDataCostCenterAndExpensesType(string entityID, ETEMEnums.CalculationType calculationType, CallContext resultContext)
 {
     return new OfferDataExpenseGroupBL().LoadOfferDataCostCenterAndExpensesType(Int32.Parse(entityID), calculationType, resultContext);
 }
Exemplo n.º 3
0
        public Setting GetSettingByCode(ETEMEnums.AppSettings appSettings)
        {
            string settingName = appSettings.ToString();
            Setting setting = this.dbContext.Settings.Where(k => k.SettingIntCode == settingName).FirstOrDefault();


            return setting;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Изпраща E-Mail на всеки от потребителите в списъка
        /// </summary>
        /// <param name="usersList"></param>
        /// <param name="resource"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        public CallContext SendMail(List<SendMailHelper> listSendMailHelper, ETEMEnums.EmailTypeEnum emailType, CallContext resultContext)
        {
            if (resultContext.ListKvParams.Where(w => w.Key == "SendExternalMail").Count() != 1)
            {
                resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                resultContext.Message = BaseHelper.GetCaptionString("EMail_External_Send_Not_Permitted");
                return resultContext;
            }
            else if (!Convert.ToBoolean(resultContext.ListKvParams.Where(w => w.Key == "SendExternalMail").First().Value))
            {
                resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                resultContext.Message = BaseHelper.GetCaptionString("EMail_External_Send_Not_Permitted");
                return resultContext;
            }

            List<string> listPersonsWithWrongEmails = new List<string>();

            string mailFrom = string.Empty;
            string mailTo = string.Empty;

            if (resultContext.ListKvParams.Where(w => w.Key == "DefaultEmail").Count() == 1)
            {
                mailFrom = resultContext.ListKvParams.Where(w => w.Key == "DefaultEmail").First().Value.ToString();
                mailTo = resultContext.ListKvParams.Where(w => w.Key == "DefaultEmail").First().Value.ToString();
            }

            switch (emailType)
            {
                case ETEMEnums.EmailTypeEnum.StudentCandidatesRanked:
                    {
                        foreach (SendMailHelper sendMailHelper in listSendMailHelper)
                        {
                            mailTo = sendMailHelper.EmailTo;

                            if (!string.IsNullOrEmpty(mailTo))
                            {
                                SendMailAction(mailFrom, mailTo,
                                               sendMailHelper.SubjectBG,
                                               sendMailHelper.BodyBG,
                                               sendMailHelper.FullName,
                                               listPersonsWithWrongEmails,
                                               resultContext);
                            }
                        }

                        if (listPersonsWithWrongEmails.Count > 0)
                        {
                            string personNames = string.Join(", ", listPersonsWithWrongEmails.OrderBy(o => o).ToArray());
                            resultContext.Message = string.Format(BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Error"),
                                                                  personNames);
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                        }
                        else
                        {
                            resultContext.Message = BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Success");
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
                        }
                    }
                    break;

                case ETEMEnums.EmailTypeEnum.PotentialStudentCandidates:
                    {
                        foreach (SendMailHelper sendMailHelper in listSendMailHelper)
                        {
                            mailTo = sendMailHelper.EmailTo;

                            if (!string.IsNullOrEmpty(mailTo))
                            {
                                SendMailAction(mailFrom, mailTo,
                                               sendMailHelper.SubjectBG,
                                               sendMailHelper.BodyBG,
                                               sendMailHelper.FullName,
                                               listPersonsWithWrongEmails,
                                               resultContext);
                            }
                        }

                        if (listPersonsWithWrongEmails.Count > 0)
                        {
                            string personNames = string.Join(", ", listPersonsWithWrongEmails.OrderBy(o => o).ToArray());
                            resultContext.Message = string.Format(BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Error"),
                                                                  personNames);
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                        }
                        else
                        {
                            resultContext.Message = BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Success");
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
                        }
                    }
                    break;

                case ETEMEnums.EmailTypeEnum.Students:
                    {
                        foreach (SendMailHelper sendMailHelper in listSendMailHelper)
                        {
                            mailTo = sendMailHelper.EmailTo;

                            if (!string.IsNullOrEmpty(mailTo))
                            {
                                SendMailAction(mailFrom, mailTo,
                                               sendMailHelper.SubjectBG,
                                               sendMailHelper.BodyBG,
                                               sendMailHelper.FullName,
                                               listPersonsWithWrongEmails,
                                               resultContext);
                            }
                        }

                        if (listPersonsWithWrongEmails.Count > 0)
                        {
                            string personNames = string.Join(", ", listPersonsWithWrongEmails.OrderBy(o => o).ToArray());
                            resultContext.Message = string.Format(BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Error"),
                                                                  personNames);
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                        }
                        else
                        {
                            resultContext.Message = BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Success");
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
                        }
                    }
                    break;

                case ETEMEnums.EmailTypeEnum.StudentCandidates:
                    {
                        foreach (SendMailHelper sendMailHelper in listSendMailHelper)
                        {
                            mailTo = sendMailHelper.EmailTo;

                            if (!string.IsNullOrEmpty(mailTo))
                            {
                                SendMailAction(mailFrom, mailTo,
                                               sendMailHelper.SubjectBG,
                                               sendMailHelper.BodyBG,
                                               sendMailHelper.FullName,
                                               listPersonsWithWrongEmails,
                                               resultContext);
                            }
                        }

                        if (listPersonsWithWrongEmails.Count > 0)
                        {
                            string personNames = string.Join(", ", listPersonsWithWrongEmails.OrderBy(o => o).ToArray());
                            resultContext.Message = string.Format(BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Error"),
                                                                  personNames);
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                        }
                        else
                        {
                            resultContext.Message = BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Success");
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
                        }
                    }
                    break;

                case ETEMEnums.EmailTypeEnum.Lecturers:
                    {
                        foreach (SendMailHelper sendMailHelper in listSendMailHelper)
                        {
                            mailTo = sendMailHelper.EmailTo;

                            if (!string.IsNullOrEmpty(mailTo))
                            {
                                SendMailAction(mailFrom, mailTo,
                                               sendMailHelper.SubjectBG,
                                               sendMailHelper.BodyBG,
                                               sendMailHelper.FullName,
                                               listPersonsWithWrongEmails,
                                               resultContext);
                            }
                        }

                        if (listPersonsWithWrongEmails.Count > 0)
                        {
                            string personNames = string.Join(", ", listPersonsWithWrongEmails.OrderBy(o => o).ToArray());
                            resultContext.Message = string.Format(BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Error"),
                                                                  personNames);
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                        }
                        else
                        {
                            resultContext.Message = BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Success");
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
                        }
                    }
                    break;

                case ETEMEnums.EmailTypeEnum.GroupStudentsLecturersEmployeesPhds:
                    {
                        foreach (SendMailHelper sendMailHelper in listSendMailHelper)
                        {
                            mailTo = sendMailHelper.EmailTo;

                            if (!string.IsNullOrEmpty(mailTo))
                            {
                                SendMailAction(mailFrom, mailTo,
                                               sendMailHelper.SubjectBG,
                                               sendMailHelper.BodyBG,
                                               sendMailHelper.FullName,
                                               listPersonsWithWrongEmails,
                                               resultContext);
                            }
                        }

                        if (listPersonsWithWrongEmails.Count > 0)
                        {
                            string personNames = string.Join(", ", listPersonsWithWrongEmails.OrderBy(o => o).ToArray());
                            resultContext.Message = string.Format(BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Error"),
                                                                  personNames);
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                        }
                        else
                        {
                            resultContext.Message = BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Success");
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
                        }
                    }
                    break;

                case ETEMEnums.EmailTypeEnum.Users:
                    {
                        foreach (SendMailHelper sendMailHelper in listSendMailHelper)
                        {
                            mailTo = sendMailHelper.EmailTo;

                            if (!string.IsNullOrEmpty(mailTo))
                            {
                                SendMailAction(mailFrom, mailTo,
                                               sendMailHelper.SubjectBG,
                                               sendMailHelper.BodyBG,
                                               sendMailHelper.FullName,
                                               listPersonsWithWrongEmails,
                                               resultContext);
                            }
                        }

                        if (listPersonsWithWrongEmails.Count > 0)
                        {
                            string personNames = string.Join(", ", listPersonsWithWrongEmails.OrderBy(o => o).ToArray());
                            resultContext.Message = string.Format(BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Error"),
                                                                  personNames);
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                        }
                        else
                        {
                            resultContext.Message = BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Success");
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
                        }
                    }
                    break;

                case ETEMEnums.EmailTypeEnum.PhD:
                    {
                        foreach (SendMailHelper sendMailHelper in listSendMailHelper)
                        {
                            mailTo = sendMailHelper.EmailTo;

                            if (!string.IsNullOrEmpty(mailTo))
                            {
                                SendMailAction(mailFrom, mailTo,
                                               sendMailHelper.SubjectBG,
                                               sendMailHelper.BodyBG,
                                               sendMailHelper.FullName,
                                               listPersonsWithWrongEmails,
                                               resultContext);
                            }
                        }

                        if (listPersonsWithWrongEmails.Count > 0)
                        {
                            string personNames = string.Join(", ", listPersonsWithWrongEmails.OrderBy(o => o).ToArray());
                            resultContext.Message = string.Format(BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Error"),
                                                                  personNames);
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                        }
                        else
                        {
                            resultContext.Message = BaseHelper.GetCaptionString("Form_Send_Email_To_Persons_Success");
                            resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
                        }
                    }
                    break;

            }

            CallContext resContext = new CallContext();

            resContext.ListKvParams = resultContext.ListKvParams;

            CheckSentEmails(resContext);

            return resultContext;
        }
Exemplo n.º 5
0
        public bool CheckUserActionPermissionByIntCode(ETEMEnums.SecuritySettings securitySetting)
        {
            if (userProps != null)
            {
                this.userProps.SecuritySetting = securitySetting.ToString();

                if (this.FormContext.DictionaryPermittedActionSetting.FirstOrDefault(s => s.Value.SecuritySetting == securitySetting.ToString()).Value != null)
                {
                    this.userProps.SecuritySettingBG = this.FormContext.DictionaryPermittedActionSetting.FirstOrDefault(s => s.Value.SecuritySetting == securitySetting.ToString()).Value.FrendlyName;
                }
                else
                {
                    this.userProps.SecuritySettingBG = "###" + securitySetting.ToString() + "###";
                }
            }

            if (this.UserProps.Roles.Any(a => a.Name == "SUPPORT"))
            {
                return true;
            }

            if (this.UserProps.Roles.Any(a => a.Name == "VIEW"))
            {
                return true;
            }

            int checkCount = (from pa in this.FormContext.DictionaryPermittedActionSetting.Values
                              where pa.SecuritySetting == securitySetting.ToString() &&
                              this.UserProps.ListUserPermittedActionsID.Contains(pa.idPermittedAction)

                              select pa.SecuritySetting).Count();

            return (checkCount > 0 ? true : false);
        }
Exemplo n.º 6
0
        public bool CheckUserActionPermission(ETEMEnums.SecuritySettings securitySetting, bool _MakeRedirect)
        {

            if (userProps != null)
            {
                this.userProps.SecuritySetting = securitySetting.ToString();
                this.userProps.SecuritySettingBG = this.FormContext.DictionaryPermittedActionSetting.FirstOrDefault(s => s.Value.SecuritySetting == securitySetting.ToString()).Value.FrendlyName;
            }

            if (this.UserProps.Roles.Any(a => a.Name == "SUPPORT"))
            {
                return true;
            }

            if (this.UserProps.Roles.Any(a => a.Name == "VIEW"))
            {
                return true;
            }

            bool result = CheckUserActionPermissionByIntCode(securitySetting);

            if (!result)
            {
                if (_MakeRedirect)
                {
                    if (this.Page.Master != null)
                    {
                        Response.Redirect("~/UI/NoPermission.aspx");
                    }
                    else
                    {
                        Response.Redirect("~/UI/NoPermissionWithoutMasterPage.aspx");
                    }
                }
                else
                {

                    ShowMSG("Нямате права за това действие!");
                }
            }

            return result;

        }
Exemplo n.º 7
0
        public static Setting GetSettingByCode(ETEMEnums.AppSettings appSettings)
        {

            Setting setting = DictionarySetting.Where(k => k.Key == appSettings.ToString()).FirstOrDefault().Value;



            return setting;
        }