예제 #1
0
        private void DecryptQueryString(HttpRequest _currRequest)
        {
            this.queryString = new System.Collections.Hashtable();
            if (_currRequest.QueryString.Count > 0)
            {
                string rowURL         = _currRequest.RawUrl.Substring(_currRequest.RawUrl.IndexOf('?') + 1);
                string rawQueryString = System.Web.HttpUtility.UrlDecode(rowURL);

                if (rawQueryString.EndsWith("&"))
                {
                    rawQueryString = rawQueryString.Substring(0, rawQueryString.Length - 1);
                }

                string queryString = BaseHelper.Decrypt(rawQueryString);

                string val;
                string key;

                string[] keys_values = queryString.Split('&');

                foreach (string key_value in keys_values)
                {
                    string[] kv = key_value.Split('=');

                    key = kv[0];
                    val = kv[1];

                    this.queryString.Add(key, val);
                }
            }
        }
예제 #2
0
        public override void UserControlLoad()
        {
            if (this.ownerPage == null)
            {
                throw new UMSException("Current Page is null or is not inheritor of BasicPage.");
            }

            InitLoadControls();

            SetEmptyValues();

            if (!string.IsNullOrEmpty(this.hdnRowMasterKey.Value) && this.hdnRowMasterKey.Value != Constants.INVALID_ID_STRING)
            {
                this.CurrentEntityMasterID = this.hdnRowMasterKey.Value;
            }

            this.currentEntity = this.ownerPage.AdminClientRef.GetUserByUserID(this.CurrentEntityMasterID);

            if (this.currentEntity != null)
            {
                this.tbxUserName.Text = this.currentEntity.UserName;

                this.tbxPassword.Attributes.Add("value", BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(this.currentEntity.Password)));
                this.tbxPassword.Text = ETEMModel.Helpers.BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(this.currentEntity.Password));

                Person person = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.currentEntity.idPerson.ToString());
                if (person != null)
                {
                    this.tbxAutoCompletePersonName.Text          = person.FullName;
                    this.tbxAutoCompletePersonName.SelectedValue = person.idPerson.ToString();

                    this.tbxEGN.Text            = person.EGN;
                    this.tbxIdentityNumber.Text = person.IdentityNumber;
                    this.tbxMail.Text           = person.EMail;
                }

                BaseHelper.CheckAndSetSelectedValue(this.ddlStatus.DropDownListCTRL, this.currentEntity.idStatus, false);
                BaseHelper.CheckAndSetSelectedValue(this.ddlCheckDomain.DropDownListCTRL, this.currentEntity.idCheckDomain, false);

                if (this.currentEntity.idAltPerson.HasValue)
                {
                    Person altPerson = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.currentEntity.idAltPerson.Value.ToString());
                    if (altPerson != null)
                    {
                        this.tbxAutoCompleteAltPersonName.Text          = altPerson.FullName;
                        this.tbxAutoCompleteAltPersonName.SelectedValue = altPerson.idPerson.ToString();
                    }
                }

                this.tbxAltPassword.Attributes.Add("value", BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(this.currentEntity.AltPassword)));
                this.tbxAltPassword.Text = ETEMModel.Helpers.BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(this.currentEntity.AltPassword));


                this.tbxDescription.Text = this.currentEntity.Description;

                this.hdnRowMasterKey.Value = this.currentEntity.idUser.ToString();

                ClearResultContext();
            }
            else
            {
                SetEmptyValues();
            }
        }
예제 #3
0
        public override Tuple <CallContext, string> UserControlSave()
        {
            bool isNewEntity = true;

            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING)
            {
                this.currentEntity = new User();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetUserByUserID(this.hdnRowMasterKey.Value);

                if (this.currentEntity == null)
                {
                    string falseResult = string.Format(BaseHelper.GetCaptionString("Entity_is_not_update_in_tab"), BaseHelper.GetCaptionString("UserMain_Data"));

                    this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error;
                    this.ownerPage.CallContext.Message    = falseResult;

                    return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("UserMain_Data")));
                }

                isNewEntity = false;
            }

            this.currentEntity.UserName = this.tbxUserName.Text.Trim();
            this.currentEntity.Password = ETEMModel.Helpers.BaseHelper.Encrypt(this.tbxPassword.Text.Trim());


            this.currentEntity.idPerson      = this.tbxAutoCompletePersonName.SelectedValueIntOrInvalidID;
            this.currentEntity.idStatus      = this.ddlStatus.SelectedValueINT;
            this.currentEntity.idCheckDomain = this.ddlCheckDomain.SelectedValueINT;
            this.currentEntity.idAltPerson   = this.tbxAutoCompleteAltPersonName.SelectedValueINT;
            this.currentEntity.AltPassword   = ETEMModel.Helpers.BaseHelper.Encrypt(this.tbxAltPassword.Text.Trim());
            this.currentEntity.Description   = this.tbxDescription.Text;

            this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;

            this.ownerPage.CallContext = this.ownerPage.AdminClientRef.UserSave(this.currentEntity, this.ownerPage.CallContext);

            this.lbResultContext.Text = this.ownerPage.CallContext.Message;
            if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success)
            {
                this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID;

                this.tbxPassword.Attributes.Add("value", BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(this.currentEntity.Password)));
                this.tbxPassword.Text = ETEMModel.Helpers.BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(this.currentEntity.Password));

                this.tbxAltPassword.Attributes.Add("value", BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(this.currentEntity.AltPassword)));
                this.tbxAltPassword.Text = ETEMModel.Helpers.BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(this.currentEntity.AltPassword));


                Person person = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.currentEntity.idPerson.ToString());
                if (isNewEntity && person != null)
                {
                    this.tbxEGN.Text            = person.EGN;
                    this.tbxIdentityNumber.Text = person.IdentityNumber;
                }
            }

            CheckIfResultIsSuccess();



            return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("UserMain_Data")));
        }
예제 #4
0
        internal CallContext UserSendingEmails(ICollection <AbstractSearch> searchCriteria, List <int> listSelectedIDs, SendMailHelper sendMailData, CallContext resultContext)
        {
            resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
            resultContext.Message    = string.Empty;
            resultContext.Result     = string.Empty;

            try
            {
                List <UserDataView> listUserDataViews = new List <UserDataView>();

                List <SendMailHelper> listEmailsForSending = new List <SendMailHelper>();


                listUserDataViews = (from u in this.dbContext.Users
                                     join p in this.dbContext.Persons on u.idPerson equals p.idPerson
                                     where listSelectedIDs.Contains(u.idUser)
                                     select new UserDataView
                {
                    Title = p.Title,
                    FirstName = p.FirstName,
                    SecondName = p.SecondName,
                    LastName = p.LastName,
                    EMail = p.EMail,
                    Password = u.Password,
                    UserName = u.UserName,
                }).ToList();



                var pattern = @"{(.*?)}";
                var matches = Regex.Matches(sendMailData.BodyBG, pattern);



                foreach (UserDataView userDataView in listUserDataViews)
                {
                    SendMailHelper sendMailHelper = new SendMailHelper()
                    {
                        FullName  = userDataView.TwoNamesPlusTitle,
                        EmailTo   = userDataView.EMail.Trim(),
                        SubjectBG = sendMailData.SubjectBG,
                        BodyBG    = (matches.Count == 3) ? string.Format(
                            sendMailData.BodyBG,
                            userDataView.TwoNamesPlusTitle,
                            userDataView.UserName,
                            BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(userDataView.Password))) : sendMailData.BodyBG
                    };

                    listEmailsForSending.Add(sendMailHelper);
                }

                resultContext = new CommonBL().SendMail(listEmailsForSending, ETEMEnums.EmailTypeEnum.Users, resultContext);
            }
            catch (Exception ex)
            {
                resultContext.ResultCode = ETEMEnums.ResultEnum.Error;
                resultContext.Message    = BaseHelper.GetCaptionString("Form_SpecialityForApplication_Error_StudentCandidates_Sending_Emails");

                BaseHelper.Log("Грешка при изпращане на имейл известия!");
                BaseHelper.Log(ex.Message);
                BaseHelper.Log(ex.StackTrace);
            }

            return(resultContext);
        }