예제 #1
0
        public override void moveTo(Point target)
        {
            changeStatusTo((int)Status.move);

            if (this.distance(target) <= 0 || this.speed == 0)
            {
                return;                        //if target in your attack range , you shouldn't move
            }
            if (target.value < this.value)     //target in your left
            {
                this.value -= speed;           //move to left

                if (target.value > this.value) //when you move too over to left of target
                {
                    this.value = target.value;
                }
            }
            else if (target.value > this.value) //target in your right
            {
                this.value += speed;            //move to right

                if (target.value < this.value)  //when you move too over to right of target
                {
                    this.value = target.value;
                }
            }

            //change your picture status and move it
            img.Left = value - leftFix;
            HP.fixPositionLeft(value - leftFix);
        }
예제 #2
0
    //MORTE
    void kill()
    {
        GameObject HP;
        Count_life life;

        HP = GameObject.FindWithTag("HP");



        if (wasborn != null)
        {
            wasborn = Instantiate(wasborn, wasborn.transform.position, wasborn.transform.rotation) as GameObject;

            life = HP.GetComponent <Count_life> ();

            life.life_hit();
        }
        else
        {
        }



        Destroy(this.gameObject, 0.05f);
        //GAME OVER
    }
예제 #3
0
    /*======================*/
    //  初期化
    /*======================*/
    void Awake()
    {
        // 初期座標を設定
        transform.position = new Vector3(-175.3f, -42.0f, 0.0f);

        b_JumpFlag       = false;
        b_CameraMoveFlag = false;

        g_Move = new Move();

        g_HP = GetComponent <HP>();
        g_HP.SetHP(cf_HPMax);
        b_AliveFlag = true;

        an_Mortion     = GetComponent <Animator>();
        n_MortionState = (int)Mortion.Stay;

        g_right2D = GetComponent <Rigidbody2D>();

        n_LeftRightFlag = (int)Direction.Right;

        g_Damege       = GameObject.Find("DamageEffect");
        g_DamegeScript = g_Damege.GetComponent <FlushController>();

        g_Jump    = GameObject.Find("Jump_Effect");
        je_Effect = g_Jump.GetComponent <JumpEffect>();
        g_Jump.SetActive(false);

        as_Sound = GetComponents <AudioSource>();
    }
예제 #4
0
    void OnEquipmentChanged(Equipment newItem, Equipment oldItem)
    {
        if (newItem != null)
        {
            HP.AddModifier(newItem.HP_modifier);
            MP.AddModifier(newItem.MP_modifier);
            PhysicalAttack.AddModifier(newItem.PhysicalAttack_modifier);
            PhysicalDefense.AddModifier(newItem.PhysicalDefense_modifier);
            MagicalAttack.AddModifier(newItem.MagicalAttack_modifier);
            MagicalDefense.AddModifier(newItem.MagicalDefense_modifier);
            CriticalRate.AddModifier(newItem.CriticalRate_modifier);
            UpdateStats();
        }

        if (oldItem != null)
        {
            HP.AddModifier(oldItem.HP_modifier);
            MP.AddModifier(oldItem.MP_modifier);
            PhysicalAttack.AddModifier(oldItem.PhysicalAttack_modifier);
            PhysicalDefense.AddModifier(oldItem.PhysicalDefense_modifier);
            MagicalAttack.AddModifier(oldItem.MagicalAttack_modifier);
            MagicalDefense.AddModifier(oldItem.MagicalDefense_modifier);
            CriticalRate.AddModifier(oldItem.CriticalRate_modifier);
            UpdateStats();
        }
    }
 public Beast(HP, Attack, Defense, Name)
 {
     this.HP      = HP;
     this.Attack  = Attack;
     this.Defense = Defense;
     this.Name    = Name;
 }
예제 #6
0
 public Monster()
 {
     Name                  = "";
     Size                  = new CreatureSize();
     Source                = "User Custom";
     Type                  = "";
     HP                    = new HP();
     AC                    = new AC();
     InitiativeModifier    = 0;
     Tags                  = new SortableBindingList <string>();
     Speed                 = new SortableBindingList <BindableString>();
     Abilities             = new Abilities();
     DamageVulnerabilities = new SortableBindingList <BindableString>();
     DamageResistances     = new SortableBindingList <BindableString>();
     DamageImmunities      = new SortableBindingList <BindableString>();
     ConditionImmunities   = new SortableBindingList <BindableString>();
     Saves                 = new SortableBindingList <Save>();
     Skills                = new SortableBindingList <Skill>();
     Senses                = new SortableBindingList <BindableString>();
     Languages             = new SortableBindingList <BindableString>();
     Challenge             = new Fraction("0");
     Traits                = new SortableBindingList <Trait>();
     Actions               = new SortableBindingList <Action>();
     Reactions             = new SortableBindingList <Reaction>();
     LegendaryActions      = new SortableBindingList <LegendaryAction>();
     Spells                = new SortableBindingList <BindableString>();
     ReadOnly              = false;
 }
예제 #7
0
    // Start is called before the first frame update
    void Start()
    {
        rigid    = gameObject.GetComponent <Rigidbody2D>();
        animator = gameObject.GetComponent <Animator>();
        movement = new Vector2();

        // footCollider.parent = this;
        // weaponCollider.parent = this;
        footCollider.EventObjectIn   += handleFootCollided;
        weaponCollider.EventObjectIn += handleWeaponCollided;

        if (ultiController)
        {
            ultiController.parent                  = this;
            ultiController.EventUltiDone          += handleUltiDone;
            ultiController.EventObjectInUltiRange += handleObjectInUltiRange;
        }

        hp = gameObject.GetComponent <HP>();
        if (hp)
        {
            lastHealth             = hp.currentHealth;
            hp.EventHealthChanged += handleHealthChanged;
        }

        // start recover for attack
        StartCoroutine(waitThenRecoverAttack(timeToRecoverOneAttack));
    }
예제 #8
0
    public void Fire(Vector3 player, string newDamage)
    {
        Ray        ray = new Ray(gameObject.transform.position, player - gameObject.transform.position);
        RaycastHit hitInfo;

        // Creates thunder effect
        GameObject newthunder;

        // If it hits something ...
        if (Physics.Raycast(ray, out hitInfo, 100, LayerMask.GetMask("isPlayer", "isGround", "Default")))
        {
            newthunder = Instantiate(thunder, firePoint.position, Quaternion.LookRotation(ray.direction.normalized));
            newthunder.GetComponent <LightningBoltScript>().StartPosition = firePoint.position;
            newthunder.GetComponent <LightningBoltScript>().EndPosition   = hitInfo.point;

            HP hp = hitInfo.collider.gameObject.GetComponent <HP>();
            if (hp)
            {
                hp.HPModifier(5, "electric");
            }
        }
        // If it does not ...
        else
        {
            newthunder = Instantiate(thunder, firePoint.position, Quaternion.LookRotation(ray.direction));
            newthunder.GetComponent <LightningBoltScript>().StartPosition = firePoint.position;
            newthunder.GetComponent <LightningBoltScript>().EndPosition   = ray.direction * 100;
        }

        Destroy(newthunder, 0.1f);
    }
예제 #9
0
    void OnCollisionEnter2D(Collision2D col)
    {
        Player player = CheckForCollisionWithPlayer(col);

        for (int i = 0; i < col.contacts.Length; i++)
        {
            if (col.contacts[i].normal.y >= 0.9f)
            {
                // crush the human beneath the weight of a mech
                if (player != null && player.isOnGround)
                {
                    HP hp = col.collider.GetComponent <HP>();
                    if (hp)
                    {
                        hp.TakeDamage(crushDamage);
                    }
                    else
                    {
                        Destroy(col.gameObject);
                    }
                }

                isOnGround           = true;
                currentTimeToTakeOff = 0;
                return; // beware, this exits the whole method!
            }
        }
    }
예제 #10
0
    void Explode()
    {
        Instantiate(explosionEfect, transform.position, zero.rotation);

        Collider[] collidersDumage = Physics.OverlapSphere(transform.position, BlastR);
        foreach (Collider nearbyObject in collidersDumage)
        {
            HP        dest = nearbyObject.GetComponent <HP>();
            Transform tr   = nearbyObject.GetComponent <Transform>();
            if (dest != null)
            {
                P         = (tr.position - transform.position).sqrMagnitude;
                Dumage1   = BlastR * BlastR * Dumage0 / P;
                HP.dumage = Dumage1;
                dest.Dumage();
            }
        }

        Collider[] collidersMove = Physics.OverlapSphere(transform.position, BlastR);
        foreach (Collider nearbyObject in collidersMove)
        {
            Rigidbody rb = nearbyObject.GetComponent <Rigidbody>();
            if (rb != null)
            {
                rb.AddExplosionForce(BlastF, transform.position, BlastR);
            }
        }

        gameObject.SetActive(false);
        hasExploded = false;
    }
예제 #11
0
    public void Damage(int damageAmount)
    {
        for (int i = hpList.Count - 1; i >= 0; i--)
        {
            HP hp = hpList[i];
            if (damageAmount > hp.GetFragmentAmount())
            {
                damageAmount -= hp.GetFragmentAmount();
                hp.Damage(hp.GetFragmentAmount());
            }
            else
            {
                hp.Damage(damageAmount);
                break;
            }
        }

        if (OnDamaged != null)
        {
            OnDamaged(this, EventArgs.Empty);
        }

        if (IsDead())
        {
            if (OnDead != null)
            {
                OnDead(this, EventArgs.Empty);
            }
        }
    }
예제 #12
0
    // Use to process your families.
    protected override void onProcess(int familiesUpdateCount)
    {
        foreach (GameObject go in _triggeredGO)
        {
            //Récupérer les élements qui peuvent être en collision
            Triggered2D t2d = go.GetComponent <Triggered2D> ();

            foreach (GameObject target in t2d.Targets)
            {
                Leucocyte leucocyte = go.GetComponent <Leucocyte> ();
                HP        hp1       = target.GetComponent <HP>();
                Absorbeur absorbe   = target.GetComponent <Absorbeur> ();
                //Si l'élément n'est pas mort et que c'est un leucocyte et qu'il n'est pas un absorbeur
                if (hp1 != null && leucocyte != null && absorbe == null)
                {
                    //on lui rajoute endommager
                    Endommage endommage = go.GetComponent <Endommage> ();
                    Debug.Log(hp1.hp);
                    hp1.hp -= endommage.hpLost;

                    /*if (hp1.hp <= 0)
                     *      GameObjectManager.destroyGameObject (target);
                     */
                }
            }
        }
    }
예제 #13
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin(transformMatrix: camera.GetViewMatrix());

            for (int i = 0; i <= backgrounds.Count - 2; i++)
            {
                backgrounds[i].Draw(spriteBatch);
            }
            torch1.Draw(spriteBatch);
            torch2.Draw(spriteBatch);
            backgrounds[backgrounds.Count - 1].Draw(spriteBatch);
            foreach (HealthPotion HP in HealthPotion.hpList)
            {
                HP.Draw(spriteBatch);
            }
            healthBar.Draw(spriteBatch);
            healthBarBoss.Draw(spriteBatch);
            foreach (Phantom phantom in phantomList)
            {
                phantom.Draw(spriteBatch);
            }
            boss.Draw(spriteBatch);
            player.Draw(spriteBatch);

            spriteBatch.End();
        }
예제 #14
0
파일: UI.cs 프로젝트: iypht46/Cyber2069
 // Start is called before the first frame update
 void Start()
 {
     score  = 0;
     Score  = GameObject.Find("ScoreText").GetComponent <Text>();
     HPbar  = GameObject.Find("HPbar").GetComponent <Image>();
     player = GameObject.Find("Player").GetComponent <HP>();
 }
예제 #15
0
    void Awake()
    {
        player = GameObject.Find("Player");
        mRb2d  = gameObject.GetComponent <Rigidbody2D>();
        target = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        anim   = transform.GetComponent <Animator>();
        state  = transform.GetComponent <MonsterState>();
        hp     = transform.GetComponent <HP>();
        rb     = transform.GetComponent <Rigidbody2D>();

        playerMove = player.GetComponent <PlayerMove>();
        playerFsm  = player.transform.GetChild(0).GetComponent <PlayerFSM>();

        Monster_State[] stateValues = (Monster_State[])System.Enum.GetValues(typeof(Monster_State));
        foreach (Monster_State s in stateValues)
        {
            System.Type     mFSMType = System.Type.GetType("Monster" + s.ToString());
            MonsterFSMState state    = (MonsterFSMState)GetComponent(mFSMType);
            if (null == state)
            {
                state = (MonsterFSMState)gameObject.AddComponent(mFSMType);
            }
            _states.Add(s, state);
            state.enabled = false;
        }
    }
예제 #16
0
    public void Shoot()
    {
        _flash.Play();
        _audio.Play();
        RaycastHit hit;
        Vector3    dir = new Vector3(_flash.transform.forward.x, _flash.transform.forward.y - 0.01f, _flash.transform.forward.z);

        if (Physics.Raycast(_flash.transform.position,
                            dir, out hit, 200f))
        {
            GameObject impact = Instantiate(_impact, hit.point, Quaternion.LookRotation(hit.normal));
            Destroy(impact, 0.1f);
            HP     hp     = hit.transform.GetComponent <HP>();
            Armour armour = hit.transform.GetComponent <Armour>();
            if (armour != null && armour.enabled)
            {
                armour.GetDamage(_damage);
                return;
            }
            if (hp != null && hit.transform.tag != transform.tag)
            {
                hp.GetDamage(_damage);
            }
        }
    }
예제 #17
0
 void Start()
 {
     Player = GameObject.Find("Player").gameObject;
     rb     = GetComponent <Rigidbody2D>();
     hp     = GetComponent <HP>();
     ui     = GameObject.Find("UI").GetComponent <UI>();
 }
예제 #18
0
 // public List<Movies> MLIST = new List<Movies>();
 public void OnGet()
 {
     using (var db = new HP())
     {
         //    MLIST = db.Movies.ToList();
     }
 }
예제 #19
0
 void Awake()
 {
     navMeshagent      = GetComponent <NavMeshAgent> ();
     viewSightCollider = GetComponentInChildren <SphereCollider> ();
     hp            = GetComponent <HP> ();
     unitDetection = GetComponentInChildren <UnitDetection>();
 }
예제 #20
0
 private void Awake()
 {
     movement = GetComponent <MovementManager>();
     HP       = GetComponentInChildren <HealthManager>();
     HP.InitializeHealth(HP.GetMaxHP());
     targetPosition = Vector2.zero;
 }
 HeroInfo(int money, int level, int nowhp, int maxhp, int atk)
 {
     HeroInfo.money = money;
     HeroInfo.level = level;
     hp             = new HP(nowhp, maxhp);
     HeroInfo.money = money;
 }
예제 #22
0
 protected void GainLevel()
 {
     Level++;
     HP.LevelUp(Level);
     MP.LevelUp(Level);
     agi.LevelUp(Level);
 }
예제 #23
0
        /// <inheritdoc/>
        public void WriteDataToStream(BinaryWriter writer)
        {
            EarthboundPlainTextEncoding PlainTextEncoding = new EarthboundPlainTextEncoding();

            writer.Write(PlainTextEncoding.GetBytesPadded(Name, 5));
            writer.Write(Level);
            writer.Write(Experience);
            writer.Write(HP.MaxValue);
            writer.Write(PP.MaxValue);
            writer.Write((byte)PermanentStatusEffect);
            writer.Write((byte)PossessionStatus);
            writer.Write((byte)BattleStatusEffect);
            writer.Write(FeelingStrange);
            writer.Write(CantConcentrateTurns);
            writer.Write(Homesick);
            //TODO: Shield
            Offense.WriteDataToStream(writer);
            Defense.WriteDataToStream(writer);
            Speed.WriteDataToStream(writer);
            Guts.WriteDataToStream(writer);
            Luck.WriteDataToStream(writer);
            Vitality.WriteDataToStream(writer);
            IQ.WriteDataToStream(writer);
            Inventory.WriteDataToStream(writer);
            HP.WriteDataToStream(writer);
            PP.WriteDataToStream(writer);
            throw new NotImplementedException("Weaknesses, miss rates, permanent boosts, shields, etc");
        }
 public void OnGet()
 {
     using (var db = new HP())
     {
         CList = db.Characters.ToList();
     }
 }
예제 #25
0
 private void SetValueToBar()
 {
     HPtext.text      = HP.ToString();
     EPtext.text      = EP.ToString();
     HPBar.localScale = Vector3.up * (HP / (float)MaxHP) + Vector3.right + Vector3.forward;
     EPBar.localScale = Vector3.up * (EP / ((float)MaxEP + 1)) + Vector3.right + Vector3.forward;
 }
예제 #26
0
    override public void SetTarget(Targetable target)
    {
        if (!target)
        {
            Debug.Log($"Spell {name} has no target. Target probably has been destroyed.");

            return;
        }

        base.SetTarget(target);

        HP hp = target.GetComponent <HP>( );

        hp.DoDamage(effectAmount, transform.position, targetFreezTime > 0);

        if (targetShockTime > 0 || targetFreezTime > 0)
        {
            Unit unit = target.GetComponent <Unit>( );
            unit.Freez(targetShockTime, targetFreezTime);

            UnitVisuals unitVis = target.GetComponent <UnitVisuals>( );
            unitVis.Shocked(targetShockTime);
        }

        if (shakeStrength > 0)
        {
            ScreenshakeManager.Instance.DoShake(shakeStrength);
        }
    }
예제 #27
0
        public string GetRow()
        {
            var sb = new StringBuilder();

            sb.Append(Name); sb.Append('\t');
            sb.Append(Plural1); sb.Append('\t');
            if (Creature.HasSecondPlural)
            {
                sb.Append(Plural2); sb.Append('\t');
            }
            sb.Append(PriceLumber.ToString()); sb.Append('\t');
            sb.Append(PriceMercury.ToString()); sb.Append('\t');
            sb.Append(PriceOre.ToString()); sb.Append('\t');
            sb.Append(PriceSulphur.ToString()); sb.Append('\t');
            sb.Append(PriceCrystals.ToString()); sb.Append('\t');
            sb.Append(PriceGems.ToString()); sb.Append('\t');
            sb.Append(PriceGold.ToString()); sb.Append('\t');
            sb.Append(FightValue.ToString()); sb.Append('\t');
            sb.Append(AIValue.ToString()); sb.Append('\t');
            sb.Append(Growth.ToString()); sb.Append('\t');
            sb.Append(hordeGrowth.ToString()); sb.Append('\t');
            sb.Append(HP.ToString()); sb.Append('\t');
            sb.Append(Speed.ToString()); sb.Append('\t');
            sb.Append(Attack.ToString()); sb.Append('\t');
            sb.Append(Defense.ToString()); sb.Append('\t');
            sb.Append(LoDamage.ToString()); sb.Append('\t');
            sb.Append(HiDamage.ToString()); sb.Append('\t');
            sb.Append(Arrows.ToString()); sb.Append('\t');
            sb.Append(Spells.ToString()); sb.Append('\t');
            sb.Append(low.ToString()); sb.Append('\t');
            sb.Append(high.ToString()); sb.Append('\t');
            sb.Append(Description.ToString()); sb.Append('\t');
            sb.Append(attributes.ToString());
            return(sb.ToString());
        }
예제 #28
0
 // Start is called before the first frame update
 void Start()
 {
     text         = GetComponent <UnityEngine.UI.Text>();
     playerHP     = hudManager.player.GetComponent <HP>();
     playerEnergy = hudManager.player.GetComponent <Energy>();
     //playerVisible = hudManager.player.GetComponent<Energy>().
 }
예제 #29
0
    // void OnCollisionEnter(Collision col) {
    //  if (col.collider.gameObject.isStatic)
    //  {
    //      Destroy(gameObject);
    //      return;
    //  }
    //  else if(col.collider.tag == "Enemy" || col.collider.tag == "Player")
    //  {
    //      if(col.collider.gameObject!=null) {
    //          HP hp = col.collider.gameObject.GetComponent<HP>();
    //          if (hp != null) {
    //              hp.takeHit(getDamage());
    //          }
    //      }
    //      Destroy(gameObject);
    //      return;
    //  }
    // }

    void OnTriggerEnter(Collider col)
    {
        // Dispose object
        if (col.gameObject.isStatic)
        {
            Destroy(gameObject);
            return;
        }
        else if ((col.tag == "Enemy" || col.tag == "Player") && originTag != col.tag)
        {
            if (col.gameObject != null)
            {
                HP hp = col.gameObject.GetComponent <HP>();
                if (hp != null)
                {
                    hp.takeHit(getDamage());
                }

                if (col.tag == "Enemy")
                {
                    EnemySight enemySight = col.gameObject.GetComponentInChildren <EnemySight>();
                    if (enemySight != null)
                    {
                        enemySight.personalLastSighting = originPoint;
                    }
                }
            }
            Destroy(gameObject);
            return;
        }
    }
예제 #30
0
    private void OnMouseDown()
    {
        Destroy(C);

        if (C.GetComponent <Renderer>().material.color == Color.red)
        {
            GameObject Score;
            Score = GameObject.Find("Score");
            string s = Score.GetComponent <TextMesh>().text;
            s = s.Substring(s.IndexOf(" "), s.Length - s.IndexOf(" "));
            int a = int.Parse(s);
            a++;
            Score.GetComponent <TextMesh>().text = "Score: " + a;
        }
        if (C.GetComponent <Renderer>().material.color == Color.blue)
        {
            GameObject HP;
            HP = GameObject.Find("HP");
            string s = HP.GetComponent <TextMesh>().text;
            s = s.Substring(s.IndexOf(" "), s.Length - s.IndexOf(" "));
            int b = int.Parse(s);
            b--;
            HP.GetComponent <TextMesh>().text = "HP: " + b;

            if (b == 0)
            {
                HP.GetComponent <TextMesh>().text = "YOU LOSE!!!";
                LoseLevel();
            }
        }
    }
예제 #31
0
 protected override bool RealValidate(HP.Rfg.Common.Questionnaire.IResponsePredefinedQuestionProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire, ref bool isLengthCorrect, ref string incorrectLengthMsg)
 {
     bool retval = base.RealValidate(elementToValidate, questionnaire, ref isLengthCorrect, ref incorrectLengthMsg);
     if (retval)
     {
         List<ResponseDto> responses = elementToValidate.GetResponseDto(-1);
         retval = elementToValidate.IsValid = HP.Rfg.lib.utility.CheckEntryToRegex(constants.REGEX_EMAIL, ((QuestionResponseDto)responses[0]).ChoiceText);
         return retval;
     }
     return false;
 }
예제 #32
0
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, string emailContent, EmailDto email, string failureReason, string modifiedMailTo)
        {
                StringBuilder messageBody = new StringBuilder();
                string mailFrom = email.EmailFrom;
                string mailTo = email.EmailTo;                
                
                string cC = email.EmailCc;
                string bCc = email.EmailBcc;
                string subject = email.Subject;

                int emailId = email.EmailId;

                string emailText;
                string emailidtext = "misconfiguration for ";
                switch (email.EmailType)
                {
                    case EmailType.ASTRO2Notification:
                        emailidtext += "ASTRO2notification-email";
                        break;
                    case EmailType.Notification:
                        emailidtext += "notification-email";
                        break;
                    case EmailType.ThankYou:
                        emailidtext += "thankyou-email";
                        break;
                    default:
                        emailidtext += "unknown-email";
                        break;
                }
                emailText = "EMAIL_DB_ID:          "+emailidtext + Environment.NewLine;
                emailText += "EMAIL_TYPE:          " + email.EmailType.ToString() + Environment.NewLine;
                emailText += "FROM:                " + mailFrom + Environment.NewLine;
                emailText += "TO:                  " + modifiedMailTo + Environment.NewLine;

                if (cC != null && cC!="")
                {
                    emailText += "CC:                  " + cC + Environment.NewLine;
                }

                if (bCc != null && bCc != "")
                {
                    emailText += "BCC:                  " + bCc + Environment.NewLine;
                }

                emailText += "SUBJECT:             " + email.Subject + Environment.NewLine;
                emailText += "CONTENT:             " + emailContent + Environment.NewLine;
                //email_text += "REASON FOR FAILURE:  " + String.Format("{0} -- {1}", failure_reason, smtp_mail.LastErrorText);
                
                messageBody.Append(emailText+Environment.NewLine);
                //messageBody.Append(emailContent);
                
                return messageBody.ToString();
        }
예제 #33
0
 protected override bool RealValidate(HP.Rfg.Common.Questionnaire.IResponseElementProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire)
 {
     bool retval = base.RealValidate(elementToValidate, questionnaire);
     if (retval)
     {
         List<ResponseDto> responses = elementToValidate.GetResponseDto(-1);
         bool valid = HP.Rfg.lib.utility.CheckEntryToRegex(constants.REGEX_EMAIL, ((QuestionResponseDto)responses[0]).ChoiceText);
         if (!valid)
             elementToValidate.SetValidationHints(new List<int>(new int[]{ PageElementWithErrorDto.InvalidEmail }));
         retval = elementToValidate.IsValid = valid;
         return retval;
     }
     return false;
 }
예제 #34
0
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, string emailContent, EmailDto email, string failureReason, string modifiedMailTo)
        {
                StringBuilder messageBody = new StringBuilder();
                string mailFrom = email.EmailFrom;
                string mailTo = email.EmailTo;                
                
                string cC = email.EmailCc;
                string bCc = email.EmailBcc;
                string subject = email.Subject;

                int emailId = email.EmailId;

                StringBuilder emailText = new StringBuilder();
                emailText.Append( "EMAIL_DB_ID:         " + emailId.ToString() + Environment.NewLine);
                emailText.Append("EMAIL_TYPE:          " + email.EmailType.ToString() + Environment.NewLine);
                emailText.Append("FROM:                " + mailFrom + Environment.NewLine);
                emailText.Append("TO:                  " + modifiedMailTo + Environment.NewLine);

                emailText.Append("CC:                  ");

                if (cC != null && cC!="")
                {
                    emailText.Append(cC);
                }
                emailText.Append(Environment.NewLine);

                emailText.Append("BCC:                  ");
                if (bCc != null && bCc != "")
                {
                    emailText.Append(bCc);
                }
                emailText.Append(Environment.NewLine);

                emailText.Append("SUBJECT:             " + email.Subject + Environment.NewLine);
                emailText.Append("CONTENT:             " + emailContent + Environment.NewLine);
                //email_text += "REASON FOR FAILURE:  " + String.Format("{0} -- {1}", failure_reason, smtp_mail.LastErrorText);
                emailText.Append("REASON FOR FAILURE:  " + String.Format("{0}", failureReason));
                messageBody.Append(emailText+Environment.NewLine);
                //messageBody.Append(emailContent);
                
                return messageBody.ToString();
        }
예제 #35
0
        protected override bool  RealValidate(HP.Rfg.Common.Questionnaire.IResponseElementProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire)
        {            
            bool hasMissingShippingData = false;
            List<ResponseDto> responses = elementToValidate.GetResponseDto(-1);
            List<int> validationHints = new List<int>();

            PersonalDataSectionDto personalDataSectionDto =  FormRegistry.PersonalDao.GetByPageId(elementToValidate.PageElement.PageId);
            if (responses != null && responses.Count > 0)
            {
                //check if any literature is selected
                List<ResponseDto> listOfQuestionResponses = responses.FindAll(r => r.GetType() == typeof(QuestionResponseDto));
                if (listOfQuestionResponses != null && listOfQuestionResponses.Count > 0)
                {
                    foreach (ResponseDto response in listOfQuestionResponses)
                    {
                        QuestionResponseDto questionResponse = response as QuestionResponseDto;
                        if (questionResponse != null)
                        {
                            PageElementChoiceDto choice = elementToValidate.Choices.Find(delegate(PageElementChoiceDto cur) { return cur.ChoiceId == questionResponse.ChoiceId; });
                            if (choice == null)
                            {
                                throw new UserCausedException(Constants.UserCausedDataFormatIncorrectElementMissmatch, "Literature validator found response (" + questionResponse.ChoiceId + ") which does not have a corresponding choice");
                            }                            
                        }
                        else
                        {
                            throw new BugException("Literature validator does not accept a response of type \"" + response.GetType().Name + "\"");
                        }
                    }        
                }

                ResponseDto shippingAddressResponse = responses.Find(pr => pr.GetType() == typeof(ShippingAddressResponseDto));
                {
                    if (shippingAddressResponse != null)
                    {
                        ShippingAddressResponseDto shAddress = shippingAddressResponse as ShippingAddressResponseDto;
                        if (!shAddress.UseProfileFlag && personalDataSectionDto != null)
                        {
                            ValidateShippingAddress(shAddress, elementToValidate, validationHints, personalDataSectionDto);                            
                        }
                    }
                    else
                        hasMissingShippingData = true;
                }

            }
            bool retval = false;
            if (elementToValidate.PageElement.IsRequired)
            {
                if (!hasMissingShippingData)
                {
                    if (validationHints.Count > 0)
                    {
                        elementToValidate.SetValidationHints(validationHints);
                    }
                    else
                    {
                        retval = true;
                    }
                }
            }
            else
            {
                retval = true;
            }            
            elementToValidate.IsValid = retval;
            return retval;
        }
예제 #36
0
        public void SetMasterReportStatus(int masterReportId, HP.Rfg.Common.QueueStatus status)
        {
            DbCommand sp = null;
            DbConnection connection = null;
            IDataReader reader = null;
            try
            {
                connection = _dbLayer.GetConnection();
                sp = connection.CreateCommand();

                //sp.CommandText = "update_queued_masterreport";
                sp.CommandText = "update_queued_report";
                sp.CommandType = CommandType.StoredProcedure;
                _dbLayer.AddInParameter(sp, "entry_id", DbType.Int32, masterReportId);
                _dbLayer.AddInParameter(sp, "status", DbType.Int32, (int)status);
                _dbLayer.AddReturnParameter(sp);
                sp.ExecuteNonQuery();
                if (_dbLayer.GetReturnValue(sp) != 0)
                {
                    throw new UserCausedException(Constants.UserCausedQueueEntryNotFound);
                }
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }

                if (sp != null)
                {
                    sp.Dispose();
                }

                if (connection != null)
                {
                    _dbLayer.ReturnConnection(connection);
                }
                else
                {
                    _dbLayer.ReturnConnection(connection, true);
                }
            }
        }
 protected override bool RealValidate(HP.Rfg.Common.Questionnaire.IResponseElementProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire)
 {
     return true;
 }
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO email, EmailDto notificationEmail)
        {

            StringBuilder messageBody = new StringBuilder();
            string contentText = notificationEmail.ContentText;
            StringBuilder personalDataContent = new StringBuilder();
            #region add customer data
            IResponseElementProvider personalElement = null;
            if (email.ResponseHolder.GetElements() != null)
                personalElement = email.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PersonalDataSection; });
            List<ResponseDto> response = null; 
            PersonalResponseDto personalData = null;

            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            PersonalDataSectionDto configuration = null;
            PersonalCrmRecordDto Submissionconfiguration = null;

            if (email.ResponseHolder.GetElements() != null)
            {
                foreach (IResponseElementProvider provider in email.ResponseHolder.GetElements())
                {
                    if (provider.PageElementType == PageElementType.PersonalDataSection)
                    {
                        configuration = provider.PageElement as PersonalDataSectionDto;
                    }
                }
                //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            }


            foreach (ResponseDto responses in email.Responses)
            {
                Type respType = responses.GetType();

                if (respType == typeof(PersonalCrmRecordDto))
                {
                    if (respType == typeof(PersonalCrmRecordDto))
                    {
                        Submissionconfiguration = (PersonalCrmRecordDto)responses;
                    }
                }

            }

            if (personalElement != null)
            {
                response = personalElement.GetResponseDto(email.ResponseKey);
            }
            else
            {
                response = new List<ResponseDto>();
                if (email.Responses.Count != -1)
                {
                    if (email.Responses[0] != null)
                    {
                        response.Add(((PersonalResponseDto)email.Responses[0]));
                        //email.Responses.Remove(email.Responses[0]);
                    }
                }
            }

            if (response.Count > 0 && response != null)
            {
                personalData = ((PersonalResponseDto)response[0]);
                //mailTo = personalData.EmailAddress;

                messageBody.Append(contentText + Environment.NewLine);
                //replyTo = personalData.EmailAddress;
                ReplaceStaticPlaceholders(messageBody, personalData);

            }
            string year = DateTime.Now.Year.ToString();
            string month = GetWithZero(DateTime.Now.Month);
            string day = GetWithZero(DateTime.Now.Day);
            string hour = GetWithZero(DateTime.Now.Hour);
            string minute = GetWithZero(DateTime.Now.Minute);
            string sec = GetWithZero(DateTime.Now.Second);

            //Added \r\n" by Chandra on 10/26/2010 for 2.2.1 Release
            messageBody.Append(String.Format("\r\n" + "Sent: {0}-{1}-{2} {3}:{4}:{5}Z (GMT)", year, month, day, hour, minute, sec));
            #endregion
            ReplaceDynamicPlaceholders(messageBody, email);

            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            Hashtable h_params = new Hashtable();
            h_params.Clear();
            h_params.Add("response_id", Convert.ToInt64(email.ResponseKey));
            if (email.CustomerId != HP.Rfg.Common.Constants.UnknownCustomer)
                h_params.Add("customer_id", email.CustomerId);
            DataTable customer_data = DB.execProc("select_customerinfo", h_params);
            ReplacePlaceholders(messageBody, customer_data);
            PlaceholdersFacade.ReplaceText(messageBody, "[url_to_questionnaire]", email.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageBody, "[wavecode]", email.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageBody, "[flexfield_jumpid]", email.ResponseHolder.JumpId);
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", Submissionconfiguration.NumberOfEmployees);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", Submissionconfiguration.JobTitle);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", personalData.BusinessCode);                
            }
            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††

            //RFG 2.11
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]", GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else if (Submissionconfiguration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]", Submissionconfiguration.CompanyRevenue);
            }

            //††† 20101013 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            StringBuilder messageSubject = new StringBuilder();
            messageSubject.Append(notificationEmail.Subject.ToString());
            ReplaceStaticPlaceholders(messageSubject, personalData);
            ReplaceDynamicPlaceholders(messageSubject, email);
            ReplacePlaceholders(messageSubject, customer_data);
            PlaceholdersFacade.ReplaceText(messageSubject, "[url_to_questionnaire]", email.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageSubject, "[wavecode]", email.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageSubject, "[flexfield_jumpid]", email.ResponseHolder.JumpId);
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[number_of_employees]", GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", Submissionconfiguration.NumberOfEmployees);
            }
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[job_code]", GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", Submissionconfiguration.JobTitle);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[business_name]", GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", personalData.BusinessCode);
            }

            //RFG 2.11
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]", GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else if (Submissionconfiguration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]", Submissionconfiguration.CompanyRevenue);
            }

            notificationEmail.Subject = messageSubject.ToString();
            //††† 20101013 Biju Pattathil | RFG 2.3 QC:4861 End†††
            return messageBody.ToString();
            

        }
 public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, EmailDto thankYouEmail, StringBuilder QuestionrespSummary)
 {
     return null;
 }   
예제 #40
0
 void Start()
 {
     hpScript = GetComponent<HP> ();
     hpScript.EventDie += DisablePlayerNow;
     hpScript.EventRespawn += EnablePlayerNow;
 }
예제 #41
0
        internal static void Process(string targetpath, HP.Rfg.tasks.DailyTasksRoutine.IMessageCallback msg)
        {
            string ll, cc, ucc, ull;
            List<CountryLanguageDto> countryLanguages = HpFramesFacade.GetListOfCountryLanguages();

            int prevMsgIndex = msg.ToString().Length;

            //do a fresh load if necessary by uncommenting below lines
            //run in debug mode only as public method "cache_hpframes" uses private variable (should be passed to method )
            //and this variable needs to be set properly in debug mode
            //(in other calling methods this is take from utility.getParameter("path_to_temp"))
            //DailyTasksRoutine dc = new DailyTasksRoutine();
            //dc.cache_hpframes(msg, false);
                    
            foreach (CountryLanguageDto item in countryLanguages)
            {

                ll = item.LanguageFK;
                cc = item.CountryFK;
                ull = ll.ToUpper();
                ucc = cc.ToUpper();

                msg.AppendLine("#### Handling (" + cc + "-" + ll + ") ####");

                try
                {
                    HpFramesDto frames = HpFramesFacade.GetHpFramesFromCache(cc, ll, true);
                

                    string headerFile = string.Format("{0}frameparts/header_{1}_{2}.txt", targetpath, ucc, ull);
                    string footerFile = string.Format("{0}frameparts/footer_{1}_{2}.txt", targetpath, ucc, ull);
                    string scriptFile = string.Format("{0}scriptparts/scripts_{1}_{2}.txt", targetpath, ucc, ull);

                    string header = CleanUp(msg, frames.HeaderFrame);
                    string footer = CleanUp(msg, frames.FooterFrame);
                    string script = Create(msg, cc, ll);

                    DailyTasksRoutine.createDir(Path.GetDirectoryName(headerFile));
                    DailyTasksRoutine.createDir(Path.GetDirectoryName(footerFile));
                    DailyTasksRoutine.createDir(Path.GetDirectoryName(scriptFile));

                    Encoding encoding = Encoding.UTF8;

                    if (header != null)
                        File.WriteAllText(headerFile, header, encoding);
                    else
                        msg.AppendLine(headerFile + " was not created: no data!");
                    
                    if (footer != null)
                        File.WriteAllText(footerFile, footer, encoding);
                    else
                        msg.AppendLine(footerFile + " was not created: no data!");

                    if (script != null)
                        File.WriteAllText(scriptFile, script, encoding);
                    else
                        msg.AppendLine(scriptFile + " was not created: no data!");
                }
                catch (Exception e)
                {
                    msg.AppendLine("!! " + e.Message);
                    continue;
                }
            }

        }
예제 #42
0
        private static string CleanUp(HP.Rfg.tasks.DailyTasksRoutine.IMessageCallback msg, string html)
        {
            // Remove Community Widget
            html = CommunityWidget.Replace(html, string.Empty);
            // do checking here
            html = html
                .Replace("<!--", Environment.NewLine+"<!--")
                .Replace("-->", "-->"+Environment.NewLine);

            MatchCollection opens = CommentOpen.Matches(html);
            MatchCollection closes = CommentClose.Matches(html);
            // HACK: fix buggy headers of early generation
            if (html.EndsWith("--") && opens.Count > closes.Count)
            {
                html += ">"; 
                closes = CommentClose.Matches(html);
            }
            if (opens.Count != closes.Count)
                throw new FormatException("Html has wrong comment format! Unbalanced closing and opening ...");

            for (int i = 0, minpos = 0; i < opens.Count; i++)
            {
                Match open = opens[i];
                Match close = closes[i];

                if (open.Index < minpos)
                {
                    throw new FormatException("Html has wrong comment format! Opening before closing (nesting)...");
                }

                if (open.Index + open.Length > close.Index)
                    throw new FormatException("Html has wrong comment format! closes within or before opening ...");

                minpos = close.Index + close.Length;
            }

            return html;
        }
        private HP.TS.Devops.CentralConnect.ClientRegistration.ClientRegistrationResult RegisterClientRequest(string serviceUrl, HP.TS.Devops.CentralConnect.ClientRegistration.RequestBody requestBody, out string xmlEscapedCSID)
        {
            HP.TS.Devops.CentralConnect.ClientRegistration.ClientRegistrationService clientRegistrationService = new HP.TS.Devops.CentralConnect.ClientRegistration.ClientRegistrationService(serviceUrl);
            HP.TS.Devops.CentralConnect.ClientRegistration.ClientRegistrationRequest clientRegistrationRequest = new HP.TS.Devops.CentralConnect.ClientRegistration.ClientRegistrationRequest(requestBody);
            string requestString = clientRegistrationRequest.RequestString;
            requestString = requestString.Replace("&", @"&amp;");

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(requestString);
            XmlNamespaceManager xmlnsManager = new XmlNamespaceManager(xmlDoc.NameTable);
            xmlnsManager.AddNamespace("isee", "http://www.hp.com/schemas/isee/5.00/event");
            XmlNode csidNode = xmlDoc.SelectSingleNode("/isee:ISEE-Registration/RegistrationSource/HP_OOSIdentifiers/CSID", xmlnsManager);
            xmlEscapedCSID = csidNode.OuterXml;
            Logger.Write("RegisterClientRequest xmlDoc.OuterXml-" + xmlDoc.OuterXml);
            return clientRegistrationService.RegisterClient2(xmlDoc.InnerXml);
        }
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, EmailDto email)
        {

            StringBuilder messageBody = new StringBuilder();
            string contentText = email.ContentText;
            string contentHtml = email.ContentHtml;

            #region add customer data
            IResponseElementProvider personalElement = null;
            if (complete.ResponseHolder.GetElements() != null)
                personalElement = complete.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PersonalDataSection; });
            
            PersonalResponseDto personalData = (PersonalResponseDto)complete.Responses.Find(a => a is PersonalResponseDto);
            ResetPwdUrlResponseDto resetUrl = (ResetPwdUrlResponseDto)complete.Responses.Find(a => (a is ResetPwdUrlResponseDto));
            CustomerInfoDto customer_data = (personalData is CustomerInfoDto) ? (CustomerInfoDto)personalData : (CustomerInfoDto)complete.Responses.Find(a => a is CustomerInfoDto);

            if ((customer_data != null) &&
                customer_data.EmailPreferences.HasValue &&
                (customer_data.EmailPreferences.Value == EmailPreferences.Html) &&
                (!string.IsNullOrEmpty(contentHtml)))
            {
                messageBody.Append(contentHtml);
            }
            else
            {
                messageBody.Append(contentText);
            }

            PersonalDataSectionDto configuration = (personalElement == null)? null : personalElement.PageElement as PersonalDataSectionDto;

            PersonalCrmRecordDto Submissionconfiguration = null;

            ReplaceStaticPlaceholders(messageBody, personalData);

            #endregion
            ReplaceDynamicPlaceholders(messageBody, complete);

            ReplacePlaceholders(messageBody, customer_data);

            PlaceholdersFacade.ReplaceText(messageBody, "[url_to_questionnaire]", complete.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageBody, "[wavecode]", complete.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageBody, "[flexfield_jumpid]", complete.ResponseHolder.JumpId);
            PlaceholdersFacade.ReplaceText(messageBody, "[url]", resetUrl.Url);

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", Submissionconfiguration.NumberOfEmployees);
            }

            if (configuration != null)
            {       
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", Submissionconfiguration.JobTitle);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", personalData.BusinessCode);
            }            
            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††

            //††† 20101013 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            StringBuilder messageSubject = new StringBuilder();
            messageSubject.Append(email.Subject);

            ReplaceStaticPlaceholders(messageSubject, personalData);
            ReplaceDynamicPlaceholders(messageSubject, complete);
            ReplacePlaceholders(messageSubject, customer_data);

            PlaceholdersFacade.ReplaceText(messageSubject, "[url_to_questionnaire]", complete.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageSubject, "[wavecode]", complete.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageSubject, "[flexfield_jumpid]", complete.ResponseHolder.JumpId);

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[number_of_employees]", GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", Submissionconfiguration.NumberOfEmployees);
            }


            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[job_code]", GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", Submissionconfiguration.JobTitle);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[business_name]", GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", personalData.BusinessCode);
            }            

            email.Subject = messageSubject.ToString();

            return messageBody.ToString();
        }
예제 #45
0
        protected override bool RealValidate(HP.Rfg.Common.Questionnaire.IResponseElementProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire)
        {
            bool hasElement = false;
            bool hasEmptyElements = false;            
            List<ResponseDto> responses = elementToValidate.GetResponseDto(-1);
            List<int> validationHints = null;
            if (responses != null && responses.Count > 0)
            {
                foreach (ResponseDto response in responses)
                {
                    FileUploadResponseDto fileUploadResponse = response as FileUploadResponseDto;

                    if (fileUploadResponse != null)
                    {
                        hasElement = true;
                        if (String.IsNullOrEmpty(fileUploadResponse.FileName))
                        {
                            hasEmptyElements = true;
                            break;
                        }
                        else
                        {
                            string regex_pattern = utility.getParameter("regex_allowed_file_types");
                            if (!Regex.IsMatch(fileUploadResponse.FileName, regex_pattern, RegexOptions.Multiline | RegexOptions.IgnoreCase))
                            {                                
                                validationHints = new List<int>();
                                validationHints.Add(PageElementWithErrorDto.InvalidFileType);
                            }

                            if (fileUploadResponse.FileBuffer.Length / (1024 * 1024) > 18 && validationHints == null)
                            {
                                validationHints = new List<int>();
                                validationHints.Add(PageElementWithErrorDto.InvalidFileType);
                            }
                        }
                    }
                    else
                    {
                        throw new UserCausedException(Constants.UserCausedDataFormatIncorrectElementMissmatch, "File Upload validator does not accept a response of type \"" + response.GetType().Name + "\"");
                    }
                }
            }
            bool retval = false;

            if (validationHints == null)
            {
                if (elementToValidate.PageElement.IsRequired)
                {
                    if (!hasEmptyElements && hasElement)
                    {
                        retval = true;
                    }
                }
                else
                {
                    retval = true;
                }
            }
            else
            {
                elementToValidate.SetValidationHints(validationHints);
            }
            elementToValidate.IsValid = retval;
            return retval;
        }
예제 #46
0
 protected override bool RealValidate(HP.Rfg.Common.Questionnaire.IResponsePredefinedQuestionProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire, ref bool isLengthCorrect, ref string incorrectLengthMsg)
 {
     throw new NotImplementedException();
 }
예제 #47
0
 protected override bool RealValidate(HP.Rfg.Common.Questionnaire.IResponseElementProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire)
 {            
     bool hasAnswer = false;
     
     List<ResponseDto> responses = elementToValidate.GetResponseDto(-1);
     if (responses != null && responses.Count > 0)
     {
         PageElementChoiceDto subscribe = null;
         PageElementChoiceDto unsubscribe = null;
         foreach (PageElementChoiceDto dto in elementToValidate.Choices)
         {
             if (dto.LovKey == constants.COMM_SUBSCRIBE)
             {
                 subscribe = dto;
             }
             else if (dto.LovKey == constants.COMM_UNSUBSCRIBE)
             {
                 unsubscribe = dto;
             }
         }
         QuestionResponseDto subscribeResponse = responses.Find(delegate(ResponseDto cur)
         {
             QuestionResponseDto me = cur as QuestionResponseDto;
             return me != null && subscribe != null && me.ChoiceId == subscribe.ChoiceId;
         }) as QuestionResponseDto;
         QuestionResponseDto unsubscribeResponse = responses.Find(delegate(ResponseDto cur)
         {
             QuestionResponseDto me = cur as QuestionResponseDto;
             return me != null && unsubscribe != null && me.ChoiceId == unsubscribe.ChoiceId;
         }) as QuestionResponseDto;
         
         if ((subscribeResponse != null || unsubscribeResponse != null) &&
             !(subscribeResponse != null && unsubscribeResponse != null))
         {
             hasAnswer = true;   
             SpecificCrmResponseDto crm = responses.Find(delegate(ResponseDto cur)
             {
                 return cur is SpecificCrmResponseDto;
             }) as SpecificCrmResponseDto;
             if (crm != null)
             {
                 if ((crm.ElementType == SpecificCrmResponseDto.ElementTypeRequestSubscribe ||
                     crm.ElementType == SpecificCrmResponseDto.ElementTypeRequestUnSubscribe)
                     && crm.QuestionId == elementToValidate.PageElement.ElementId
                     && crm.PageId == elementToValidate.PageElement.PageId
                     && crm.CrmSubmit == questionnaire.SendToCrm
                     && crm.CidSubmit == false
                     && crm.QuestionnaireId == questionnaire.QuestionnaireId
                     && !String.IsNullOrEmpty(crm.RespDesc))
                 {
                 }
                 else
                 {
                     throw new UserCausedException(Constants.UserCausedDataFormatIncorrect, "crm un- and subscribe requires a valid specific crm response");
                 }
             }
             else
             {
                 throw new UserCausedException(Constants.UserCausedDataFormatIncorrectElementMissing, "crm un- and subscribe requires a specific crm response");
             }
         }                                
     }
     bool retval = true;
     if (elementToValidate.PageElement.IsRequired)
     {
         if (!hasAnswer)
         {                    
             retval = false;
         }                
     }
     elementToValidate.IsValid = retval;
     return retval;
 }
 private HP.TS.Devops.CentralConnect.OOSRegistration.OOSRegistrationServiceResult RegisterDeviceRequest(string serviceUrl, HP.TS.Devops.CentralConnect.OOSRegistration.RequestBody requestBody, string clientCSID, string clientOSGDID, string clientRegistrationToken)
 {
     WSHttpBinding wsb = new WSHttpBinding(SecurityMode.Transport);
     wsb.SendTimeout = new TimeSpan(10, 10, 10);
     wsb.ReceiveTimeout = new TimeSpan(10, 10, 10);
     wsb.OpenTimeout = new TimeSpan(10, 10, 10);
     wsb.CloseTimeout = new TimeSpan(10, 10, 10);
     wsb.MaxBufferPoolSize = 500000000;
     wsb.MaxReceivedMessageSize = 500000000;
     HP.TS.Devops.CentralConnect.OOSRegistration.OOSRegistrationServiceClient oosRegistrationServiceClient = new HP.TS.Devops.CentralConnect.OOSRegistration.OOSRegistrationServiceClient(wsb, new EndpointAddress(serviceUrl));
     HP.TS.Devops.CentralConnect.OOSRegistration.OOSRegistrationRequest oosRegistrationRequest = new HP.TS.Devops.CentralConnect.OOSRegistration.OOSRegistrationRequest(requestBody);
     string request = oosRegistrationRequest.RequestString;
     Logger.Write("oosRegistrationRequest.RequestString-" + request);
     HP.TS.Devops.CentralConnect.OOSRegistration.OOSRegistrationServiceResult oosRegistrationServiceResult = oosRegistrationServiceClient.Register(new HP.TS.Devops.CentralConnect.OOSRegistration.IseeWebServicesHeader()
         {
             CSID = clientCSID, // send web request with CSID of Device not client
             GDID = clientOSGDID, // OSGDID from client
             registrationToken = clientRegistrationToken  //client registration token
         },
           request  //whole template xml
     );
     Logger.Write("OOSRegistrationServiceResult", request);
     return oosRegistrationServiceResult;
 }
예제 #49
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="email"></param>
        /// <param name="notificationEmail"></param>
        /// <returns></returns>
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO email, EmailDto notificationEmail, StringBuilder QuestionRespSummary)
        {

            StringBuilder questionnaireDataContent = new StringBuilder();
            //CampaignDto campaign = FormRegistry.CampaignDao.get
            string contentText = notificationEmail.ContentText + Environment.NewLine;

            #region fill questionnaireData
            //questionnaireDataContent = ResponseHolder.QuestionnaireDto.QuestionaireId.ToString();
            string campaignTitle = email.ResponseHolder.QuestionnaireDto.CampaignCode;

            questionnaireDataContent.Append(String.Format("QUESTIONNAIRE: <<CAMPAIGN: {0} CC: {1} LL: {2} TITLE: {3}>>", campaignTitle, email.ResponseHolder.QuestionnaireDto.CountryCode, email.ResponseHolder.QuestionnaireDto.LanguageCode, email.ResponseHolder.QuestionnaireDto.QidTitle) + Environment.NewLine);
            questionnaireDataContent.Append(String.Format("{0}: {1}", HP.Rfg.Common.Constants.QuestionnaireId.ToUpper(), email.ResponseHolder.QuestionnaireDto.QuestionnaireId) + Environment.NewLine);

            #endregion
            StringBuilder personalDataContent = new StringBuilder();
            #region add customer data
            IResponseElementProvider personalElement = null;
            if (email.ResponseHolder.GetElements() != null)
                personalElement = email.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PersonalDataSection; });
            PersonalDataSectionDto configuration = null;
            if (email.ResponseHolder.GetElements() != null)
            {
                foreach (IResponseElementProvider provider in email.ResponseHolder.GetElements())
                {
                    if (provider.PageElementType == PageElementType.PersonalDataSection)
                    {
                        configuration = provider.PageElement as PersonalDataSectionDto;
                    }
                }
            }
            else
            {
                configuration = FormRegistry.PersonalDao.GetByPageId(email.ResponseHolder.PageDto.PageId);
            }

            List<ResponseDto> response = null;
            if (personalElement != null)
            {
                response = personalElement.GetResponseDto(email.ResponseKey);
            }
            else
            {
                response = new List<ResponseDto>();
                if (email.Responses.Count != -1)
                {
                    if (email.Responses[0] != null)
                    {
                        response.Add(((PersonalResponseDto)email.Responses[0]));
                      //  email.Responses.Remove(email.Responses[0]);
                    }
                }
            }

            PersonalResponseDto personalData = null;
            if (response != null && response.Count > 0)
            {
                personalData = ((PersonalResponseDto)response[0]);
                personalDataContent.Append(HP.Rfg.Common.Constants.CustomerId.ToUpper() + ": " + email.CustomerId + Environment.NewLine);
                //configuration.CountryRegionChoices;
                personalDataContent.Append(HP.Rfg.Common.Constants.CountryFk.ToUpper() + ": " + GetValueOfList(configuration.CountryRegionChoices, personalData.CountryCode) + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.LanguageFk.ToUpper() + ": " + email.ResponseHolder.QuestionnaireDto.LanguageCode + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.EmailAddress.ToUpper() + ": " + personalData.EmailAddress + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.FirstName.ToUpper() + ": " + personalData.FirstName + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.LastName.ToUpper() + ": " + personalData.LastName + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.CompanyId.ToUpper() + ": " + Environment.NewLine);//TODO: cs personalized
                personalDataContent.Append(HP.Rfg.Common.Constants.CompanyName.ToUpper() + ": " + personalData.CompanyName + Environment.NewLine);

                //RFG 2.11
                personalDataContent.Append(HP.Rfg.Common.Constants.CompanyWebsite.ToUpper() + ": " + personalData.CompanyWebsite + Environment.NewLine);
                string temp = "";
                temp = configuration != null ? GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue) : "";
                personalDataContent.Append(HP.Rfg.Common.Constants.CompanyRevenue.ToUpper() + ": " + temp + Environment.NewLine);

                //configuration.CompanySizeChoices;
                if (configuration != null)
                {
                    temp = GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize);
                }
                personalDataContent.Append(HP.Rfg.Common.Constants.NumberOfEmployees.ToUpper() + ": " + temp + Environment.NewLine);
                //configuration.JobChoices;
                if (configuration != null)
                {
                    temp = GetValueOfList(configuration.JobChoices, personalData.JobCode);
                }
                else
                {
                    temp = "";
                }
                personalDataContent.Append(HP.Rfg.Common.Constants.JobCode.ToUpper() + ": " + temp + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.JobTitle.ToUpper() + ": " + personalData.JobTitle + Environment.NewLine);
                //configuration.BusinessChoices;
                if (configuration != null)
                {
                    temp = GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode);
                }
                else
                {
                    temp = "";
                }
                personalDataContent.Append(HP.Rfg.Common.Constants.BusinessName.ToUpper() + ": " + temp + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.GreetingString.ToUpper() + ": " + Environment.NewLine);//TODO: cs personalized
                //configuration.PersonalTitleChoices;
                if (configuration != null)
                {
                    temp = GetValueOfList(configuration.PersonalTitleChoices, personalData.PersonalTitle);
                }
                else
                {
                    temp = "";
                }
                personalDataContent.Append(HP.Rfg.Common.Constants.PersonalTitle.ToUpper() + ": " + temp + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Address1.ToUpper() + ": " + personalData.Address1 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Address2.ToUpper() + ": " + personalData.Address2 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Address3.ToUpper() + ": " + personalData.Address3 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Town.ToUpper() + ": " + personalData.Town + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.County.ToUpper() + ": " + personalData.County + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.PostCode.ToUpper() + ": " + personalData.Postcode + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.TelephoneCountry.ToUpper() + ": " + personalData.TelephoneCountry + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.TelephoneArea.ToUpper() + ": " + personalData.TelephoneArea + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Telephone.ToUpper() + ": " + personalData.TelephoneNumber + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.TelephoneExtn.ToUpper() + ": " + personalData.TelephoneExt + Environment.NewLine);

                personalDataContent.Append(HP.Rfg.Common.Constants.FaxCountry.ToUpper() + ": " + personalData.FaxCountry + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.FaxArea.ToUpper() + ": " + personalData.FaxArea + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.FaxNumber.ToUpper() + ": " + personalData.FaxNumber + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.FaxExtn.ToUpper() + ": " + personalData.FaxExt + Environment.NewLine);

                personalDataContent.Append(HP.Rfg.Common.Constants.MobileCountry.ToUpper() + ": " + personalData.MobileCountry + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.MobileNumber.ToUpper() + ": " + personalData.MobileNumber + Environment.NewLine);

                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield1.ToUpper() + ": " + personalData.FlexField1 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield2.ToUpper() + ": " + personalData.FlexField2 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield3.ToUpper() + ": " + personalData.FlexField3 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield4.ToUpper() + ": " + personalData.FlexField4 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield5.ToUpper() + ": " + personalData.FlexField5 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield6.ToUpper() + ": " + personalData.FlexField6 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield7.ToUpper() + ": " + personalData.FlexField7 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield8.ToUpper() + ": " + personalData.FlexField8 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield9.ToUpper() + ": " + personalData.FlexField9 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield10.ToUpper() + ": " + personalData.FlexField10 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield11.ToUpper() + ": " + personalData.FlexField11 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield12.ToUpper() + ": " + personalData.FlexField12 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield13.ToUpper() + ": " + personalData.FlexField13 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield14.ToUpper() + ": " + personalData.FlexField14 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield15.ToUpper() + ": " + personalData.FlexField15 + Environment.NewLine);

                personalDataContent.Append(HP.Rfg.Common.Constants.Pwd.ToUpper() + ": " + personalData.Pwd + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.SiebelConId.ToUpper() + ": " + Environment.NewLine);//TODO: cs personalized
                personalDataContent.Append(HP.Rfg.Common.Constants.SiebelProspId.ToUpper() + ": " + Environment.NewLine);//TODO: cs personalized




            }

            IResponseElementProvider privacyElement = null;
            if (email.ResponseHolder.GetElements() != null)
            {
                privacyElement = email.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PrivacyDataSection; });
            }

            List<ResponseDto> privacyResponse = null;
            if (privacyElement != null)
            {
                privacyResponse = privacyElement.GetResponseDto(email.ResponseKey);
            }
            else
            {
                privacyResponse = new List<ResponseDto>();
                if (email.Responses.Count > 0)
                {
                    if (email.Responses[1] != null)
                    {
                        privacyResponse.Add(((PrivacyResponseDto)email.Responses[1]));
                      //  email.Responses.Remove(email.Responses[1]);
                    }
                }
            }
            if (privacyResponse.Count > 0)
            {
                PrivacyResponseDto privacyData = ((PrivacyResponseDto)privacyResponse[0]);
                string contactByPost = "";
                string contactByPhone = "";
                string contactByEmail = "";
                string mailStop = "";
                string emailPreferences = "";
                if (privacyData.ContactByEmail.HasValue) contactByEmail = privacyData.ContactByEmail.Value.ToString();
                if (privacyData.ContactByPhone.HasValue) contactByPhone = privacyData.ContactByPhone.Value.ToString();
                if (privacyData.ContactByPost.HasValue) contactByPost = privacyData.ContactByPost.Value.ToString();
                if (privacyData.MailStop.HasValue) mailStop = privacyData.MailStop.Value.ToString();
                if (privacyData.EmailPreferences.HasValue) emailPreferences = privacyData.EmailPreferences.Value.ToString();

                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByEmail.ToUpper() + ": " + contactByEmail + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.EmailPref.ToUpper() + ": " + emailPreferences + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByPost.ToUpper() + ": " + contactByPost + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByPhone.ToUpper() + ": " + contactByPhone + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.MailstopFlag.ToUpper() + ": " + mailStop + Environment.NewLine);

            }
            else
            {
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByEmail.ToUpper() + ": " + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.EmailPref.ToUpper() + ": " + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByPost.ToUpper() + ": " + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByPhone.ToUpper() + ": " + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.MailstopFlag.ToUpper() + ": " + Environment.NewLine);
            }


            personalDataContent.Append(HP.Rfg.Common.Constants.ResponseFk.ToUpper() + ": " + email.ResponseKey + Environment.NewLine);
            personalDataContent.Append(HP.Rfg.Common.Constants.ResponserId.ToUpper() + ": " + email.ResponserId + Environment.NewLine);
            personalDataContent.Append(HP.Rfg.Common.Constants.UrlToQuestionnaire.ToUpper() + ": " + email.ResponseHolder.RequestUrl + Environment.NewLine);
            personalDataContent.Append(HP.Rfg.Common.Constants.WaveCode.ToUpper() + ": " + email.ResponseHolder.WaveCode + Environment.NewLine);
            personalDataContent.Append(HP.Rfg.Common.Constants.FlexfieldJumpid.ToUpper() + ": " + email.ResponseHolder.JumpId + Environment.NewLine);
            personalDataContent.Append(Environment.NewLine);
            #endregion
            StringBuilder responseContent = new StringBuilder();


            #region add responses
            //foreach (IResponseElementProvider element in email.ResponseHolder.GetElements())
            //{
            //    List<ResponseDto> responseElements = element.GetResponseDto(email.ResponseKey);

            //    if (/*element.PageElementType != PageElementType.MailToSubject && */element.PageElementType != PageElementType.PrivacyDataSection && element.PageElementType != PageElementType.PersonalDataSection && responseElements != null)
            //    {
            //        responseContent.Append(element.PageElement.ElementText + ": ");
            //        if (responseElements != null)
            //        {
            //            string answer = "";
            //            foreach (ResponseDto rd in responseElements)
            //            {
            //                QuestionResponseDto qrd = rd as QuestionResponseDto;
            //                if (qrd != null)
            //                {
            //                    int choiceId = qrd.ChoiceId;
            //                    PageElementChoiceDto choice = element.Choices.Find(delegate(PageElementChoiceDto pecd) { return pecd.ChoiceId == choiceId; });
            //                    if (choice != null)
            //                    {
            //                        answer = answer.TrimStart(' ');
            //                        if (answer != "")
            //                        {
            //                            answer += ", ";
            //                        }
            //                        answer += choice.ElementText;
            //                        if (qrd.ListOfValuesId != null)
            //                        {
            //                            answer += " - " + choice.Choices.Find(delegate(LovInfo lov) { return lov.LovKey == qrd.ListOfValuesId; }).ColValue;
            //                        }
            //                    }
            //                    if (!string.IsNullOrEmpty(qrd.ChoiceText))
            //                    {
            //                        answer = answer.TrimStart(' ');
            //                        if (answer != "")
            //                        {
            //                            answer += " - ";
            //                        }
            //                        answer += qrd.ChoiceText;
            //                    }
            //                }
            //            }
            //            responseContent.Append(answer);
            //            responseContent.Append(Environment.NewLine);
            //        }
            //    }
            //}


            string[] QustionAnswers = new string[100];

            QuestionRespSummary = QuestionRespSummary.Replace(HP.Rfg.lib.utility.getParameter("crm_summary_delimiter_before_customquestions").ToString(), string.Empty);

            QustionAnswers = QuestionRespSummary.ToString().Split('^');

            for (int i = 0; i <= QustionAnswers.Length - 1; i++)
            {

                responseContent.Append(QustionAnswers[i].ToString().Replace(Environment.NewLine, ""));
                responseContent.Append("\t");
                responseContent.Append(Environment.NewLine);
               
            }

          //  responseContent.Append(Environment.NewLine);

            #endregion

            #region send mail
            #endregion

            StringBuilder messageBody = new StringBuilder();


            messageBody.Append(contentText);
            messageBody.Append(Environment.NewLine);
            messageBody.Append(Environment.NewLine);
            messageBody.Append("ADDITIONAL CUSTOMER DATA AS FOLLOWS");
            messageBody.Append(Environment.NewLine);
            messageBody.Append("-----------------------------------");
            messageBody.Append(Environment.NewLine);
            messageBody.Append(questionnaireDataContent.ToString());
            messageBody.Append(personalDataContent.ToString());
            messageBody.Append("QUESTIONNAIRE ANSWERS AS FOLLOWS" + Environment.NewLine);
            messageBody.Append("-----------------------------------" + Environment.NewLine);
            messageBody.Append(responseContent.ToString());
            ReplaceStaticPlaceholders(messageBody, personalData);
            ReplaceDynamicPlaceholders(messageBody, email);

            //††† 20101014 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            Hashtable h_params = new Hashtable();
            h_params.Clear();
            h_params.Add("response_id", Convert.ToInt64(email.ResponseKey));
            if (email.CustomerId != HP.Rfg.Common.Constants.UnknownCustomer)
                h_params.Add("customer_id", email.CustomerId);
            DataTable customer_data = HP.Rfg.lib.DB.execProc("select_customerinfo", h_params);
            ReplacePlaceholders(messageBody, customer_data);
            PlaceholdersFacade.ReplaceText(messageBody, "[url_to_questionnaire]".ToLower(), email.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageBody, "[wavecode]".ToLower(), email.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageBody, "[flexfield_jumpid]".ToLower(), email.ResponseHolder.JumpId);
            if (personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, personalData.JobCode));
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, string.Empty));
            }
            //††† 20101014 Biju Pattathil | RFG 2.3 QC: 4861 Start†††

            //††† 20101004 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            StringBuilder messageSubject = new StringBuilder();
            messageSubject.Append(notificationEmail.Subject.ToString());
            ReplaceStaticPlaceholders(messageSubject, personalData);
            ReplaceDynamicPlaceholders(messageSubject, email);
            ReplacePlaceholders(messageSubject, customer_data);
            PlaceholdersFacade.ReplaceText(messageSubject, "[url_to_questionnaire]".ToLower(), email.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageSubject, "[wavecode]".ToLower(), email.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageSubject, "[flexfield_jumpid]".ToLower(), email.ResponseHolder.JumpId);
            if (personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
                PlaceholdersFacade.ReplaceText(messageSubject, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, personalData.JobCode));
                PlaceholdersFacade.ReplaceText(messageSubject, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, string.Empty));
            }
            notificationEmail.Subject = messageSubject.ToString();
            //††† 20101004 Biju Pattathil | RFG 2.3 QC:4861 End†††

            //MailRegistry.Mailer.SendMail(mailTo, mailFrom, subject, messageBody.ToString());
            return messageBody.ToString();



        }
예제 #50
0
        protected override bool RealValidate(HP.Rfg.Common.Questionnaire.IResponseElementProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire)
        {
            bool retval = false;
            bool hasElement = false;
            bool hasMinLength = false;
            bool hasEmptyElements = false;
            bool isEqual = false;

            List<ResponseDto> responses = elementToValidate.GetResponseDto(-1);
            List<int> validationHints = new List<int>();

            if (responses != null && responses.Count > 0)
            {
                PersonalResponseDto personal = ((PersonalResponseDto)responses[0]);
                if (personal != null)
                {
                    hasElement = true;
                    if (String.IsNullOrEmpty(personal.Pwd) && String.IsNullOrEmpty(personal.Pwdconfirm))
                    {
                        hasEmptyElements = true;
                    }
                    else
                    {
                        if ((personal.Pwd.Length > MaxPwdLength) || (personal.Pwdconfirm.Length > MaxPwdLength))
                        {
                            validationHints.Add(PageElementWithErrorDto.InvalidInputTooLong);
                        }
                    }

                    if (!hasEmptyElements)
                    {
                        isEqual = string.Equals(personal.Pwd, personal.Pwdconfirm);
                        if (!isEqual) validationHints.Add(PageElementWithErrorDto.PasswordsDontMatch);
                        hasMinLength = (personal.Pwd.Length >= MinPwdLength) && (personal.Pwdconfirm.Length >= MinPwdLength);
                        if (!hasMinLength) validationHints.Add(PageElementWithErrorDto.PasswordsToShort);
                    }
                }
                else
                {
                    throw new UserCausedException(Constants.UserCausedDataFormatIncorrectElementMissmatch, "Password validator does not accept a response of type \"" + responses[0].GetType().Name + "\"");
                }
                

                if (validationHints.Count == 0)
                {
                    if (elementToValidate.PageElement.IsRequired)
                    {
                        if (!hasEmptyElements && hasElement && hasMinLength)
                        {
                            retval = isEqual;
                        }
                    }
                    else
                    {
                        retval = (hasMinLength && isEqual) || hasEmptyElements;
                    }
                }
                else
                {
                    elementToValidate.SetValidationHints(validationHints);
                }
            }
            
            elementToValidate.IsValid = retval;
            return retval;
        }
예제 #51
0
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, EmailDto thankYouEmail)
        {

            StringBuilder messageBody = new StringBuilder();
            string contentText = thankYouEmail.ContentText;
            string contentHtml = thankYouEmail.ContentHtml;

            StringBuilder personalDataContent = new StringBuilder();
            #region add customer data
            IResponseElementProvider personalElement = null;
            if (complete.ResponseHolder.GetElements() != null)
                personalElement = complete.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PersonalDataSection; });
            List<ResponseDto> response = null; 
            PersonalResponseDto personalData = null;
            bool isBodyHtml = false;

            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            PersonalDataSectionDto configuration = null;

            PersonalCrmRecordDto Submissionconfiguration = null;

            if (complete.ResponseHolder.GetElements() != null)
            {
                foreach (IResponseElementProvider provider in complete.ResponseHolder.GetElements())
                {
                    if (provider.PageElementType == PageElementType.PersonalDataSection)
                    {
                        configuration = provider.PageElement as PersonalDataSectionDto;
                    }
                }
                //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            }
            

            foreach (ResponseDto responses in complete.Responses)
            {
                Type respType = responses.GetType();

                if (respType == typeof(PersonalCrmRecordDto))
                {
                    if (respType == typeof(PersonalCrmRecordDto))
                    {
                        Submissionconfiguration = (PersonalCrmRecordDto)responses;
                    }
                }

            }

            if (personalElement != null)
            {
                response = personalElement.GetResponseDto(complete.ResponseKey);
            }
            else
            {
                response = new List<ResponseDto>();
                if (complete.Responses.Count != -1)
                {
                    if (complete.Responses[0] != null)
                    {
                        response.Add(((PersonalResponseDto)complete.Responses[0]));
                        //complete.Responses.Remove(complete.Responses[0]);
                    }
                }
            }

            if (response != null && response.Count > 0)
            {
                personalData = ((PersonalResponseDto)response[0]);

                if (personalData.EmailPreferences.HasValue && personalData.EmailPreferences == EmailPreferences.Html) isBodyHtml = true;

                //Added one more condition by Chandra for IM6724896 (QC4861) on 10/25/2010 for 2.2.1 Release
                if (isBodyHtml && contentHtml != null)
                    messageBody.Append(contentHtml);
                else
                    messageBody.Append(contentText);
                //End
                ReplaceStaticPlaceholders(messageBody, personalData);
            }
            else
            {
                if (isBodyHtml && contentHtml != null)
                    messageBody.Append(contentHtml);
                else
                    messageBody.Append(contentText);
            }
            #endregion
            ReplaceDynamicPlaceholders(messageBody, complete);
            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            Hashtable h_params = new Hashtable();
            h_params.Clear();
            h_params.Add("response_id", Convert.ToInt64(complete.ResponseKey));
            if (complete.CustomerId != HP.Rfg.Common.Constants.UnknownCustomer)
                h_params.Add("customer_id", complete.CustomerId);
            DataTable customer_data = DB.execProc("select_customerinfo", h_params);
            ReplacePlaceholders(messageBody, customer_data);
            PlaceholdersFacade.ReplaceText(messageBody, "[url_to_questionnaire]".ToLower(), complete.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageBody, "[wavecode]".ToLower(), complete.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageBody, "[flexfield_jumpid]".ToLower(), complete.ResponseHolder.JumpId);

            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), Submissionconfiguration.NumberOfEmployees);
            }

            if (configuration != null && personalData != null)
            {       
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), Submissionconfiguration.JobTitle);
            }

            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {

                if (Submissionconfiguration != null && personalData != null)
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), personalData.BusinessCode);
            }            
            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††

            //RFG 2.11
            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else if (Submissionconfiguration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]".ToLower(), Submissionconfiguration.CompanyRevenue);
            }        

            //††† 20101013 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            StringBuilder messageSubject = new StringBuilder();
            messageSubject.Append(thankYouEmail.Subject.ToString());
            ReplaceStaticPlaceholders(messageSubject, personalData);
            ReplaceDynamicPlaceholders(messageSubject, complete);
            ReplacePlaceholders(messageSubject, customer_data);
            PlaceholdersFacade.ReplaceText(messageSubject, "[url_to_questionnaire]".ToLower(), complete.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageSubject, "[wavecode]".ToLower(), complete.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageSubject, "[flexfield_jumpid]".ToLower(), complete.ResponseHolder.JumpId);

            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), Submissionconfiguration.NumberOfEmployees);
            }


            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), Submissionconfiguration.JobTitle);
            }

            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {

                if (Submissionconfiguration != null && personalData != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), personalData.BusinessCode);
            }

            //RFG 2.11
            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else if (Submissionconfiguration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]".ToLower(), Submissionconfiguration.CompanyRevenue);
            }

            thankYouEmail.Subject = messageSubject.ToString();
            //††† 20101013 Biju Pattathil | RFG 2.3 QC:4861 End†††
            return messageBody.ToString();
            

        }
예제 #52
0
 protected override bool RealMobileValidate(HP.Rfg.Common.Questionnaire.IResponseElementProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire)
 {
     throw new NotImplementedException();
 }
예제 #53
0
        private static string Create(HP.Rfg.tasks.DailyTasksRoutine.IMessageCallback msg, string cc, string ll)
        {
            string code = "/_CC_/_LL_/";

            if (templateScript == null)
            {
                string BasePath = Environment.CurrentDirectory + "\\";
                string path = BasePath + utility.getParameter("path_to_scriptparts");
                string templateName = string.Format("{0}scripts_template.txt", path, cc, ll);
                templateScript = File.ReadAllText(templateName, Encoding.UTF7);
            }
            return templateScript.Replace(code, "/" + cc + "/" + ll + "/");
        }
예제 #54
0
 void projectService_ScriptSaved(object sender, HP.Utt.ProjectSystem.SaveEventArgs e)
 {
     AddTransactionNames(e.Script as IVuGenScript);
 }
예제 #55
0
 protected override bool RealValidate(HP.Rfg.Common.Questionnaire.IResponseElementProvider elementToValidate, HP.Rfg.Common.Questionnaire.QuestionnaireDto questionnaire)
 {
     //TODO:Check, update, finish
     throw new NotImplementedException();
 }