Esempio n. 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (!(lstSelected.Items.Count > 0))
            {
                infobar.InnerText = "Please select at least one inclusion group";
                infobar.Visible   = true;
                return;
            }
            if (OfferEligibilePointsCondition == null)
            {
                OfferEligibilePointsCondition = new CMS.AMS.Models.PointsCondition();
            }
            if (OfferEligibilePointsCondition.ConditionID == 0)
            {
                OfferEligibilePointsCondition.JoinTypeID = CMS.AMS.Models.JoinTypes.And;
            }
            if (chkDisallow_Edit.Visible)
            {
                OfferEligibilePointsCondition.DisallowEdit = chkDisallow_Edit.Checked;
            }
            OfferEligibilePointsCondition.Deleted     = false;
            OfferEligibilePointsCondition.ConditionID = ConditionID;

            OfferEligibilePointsCondition.ConditionTypeID = ConditionTypeID;
            OfferEligibilePointsCondition.EngineID        = EngineID;
            //OfferEligibilePointsCondition.PointsConditionID = PointsConditionID;
            OfferEligibilePointsCondition.RequiredFromTemplate = false;
            OfferEligibilePointsCondition.Quantity             = txtValueNeeded.Text.ConvertToInt32();
            OfferEligibilePointsCondition.ProgramID            = lstSelected.Items[0].Value.ConvertToLong();
            if (OfferEligibilePointsCondition.Quantity == 0)
            {
                infobar.InnerText = Copient.PhraseLib.Lookup("pointscondition.invalidValueNeeded", LanguageID);
                infobar.Visible   = true;
            }
            else
            {
                m_Offer.CreateUpdateOfferEligiblePointsCondition(OfferID, EngineID, OfferEligibilePointsCondition);
                m_Offer.UpdateOfferStatusToModified(OfferID, EngineID, CurrentUser.AdminUser.ID);
                m_OAWService.ResetOfferApprovalStatus(OfferID);
                historyString = PhraseLib.Lookup("history.CustomerPointConditionEdit", LanguageID) + ":" + lstSelected.Items[0].Text + " requires " + txtValueNeeded.Text.ConvertToInt32();
                WriteToActivityLog();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Close", "CloseModel()", true);
            }
        }
        catch (Exception ex)
        {
            infobar.InnerText = ErrorHandler.ProcessError(ex);
            infobar.Visible   = true;
        }
    }
Esempio n. 2
0
    private void GetOfferEligiblePointsCondition()
    {
        if (ConditionID > 0)
        {
            OfferEligibilePointsCondition = m_PointsCondition.GetConditionByID(ConditionID);
        }
        if (IncludedPointProgram == null)
        {
            IncludedPointProgram = new List <CMS.AMS.Models.PointsProgram>();
        }
        if (OfferEligibilePointsCondition == null)
        {
            OfferEligibilePointsCondition = new CMS.AMS.Models.PointsCondition();
        }
        else
        {
            CMS.AMS.Models.PointsProgram objPointsProgram = new CMS.AMS.Models.PointsProgram();
            objPointsProgram.ProgramID = OfferEligibilePointsCondition.ProgramID;

            IncludedPointProgram.Add(OfferEligibilePointsCondition.PointsProgram);
            SetValues(OfferEligibilePointsCondition);
        }
    }
Esempio n. 3
0
    protected void repPointConditions_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.DataItem != null)
        {
            CMS.AMS.Models.PointsCondition PointCondition = e.Item.DataItem as CMS.AMS.Models.PointsCondition;
            if (pointsrecordcount > 0)
            {
                if (e.Item.FindControl("lnkJoinType") != null)
                {
                    ((LinkButton)e.Item.FindControl("lnkJoinType")).Text = GetJoinTypeText(PointCondition.JoinTypeID);
                    if ((bEnableRestrictedAccessToUEOfferBuilder && isTranslatedOffer) || (bEnableAdditionalLockoutRestrictionsOnOffers && !bOfferEditable))
                    {
                        ((LinkButton)e.Item.FindControl("lnkJoinType")).Enabled = false;
                    }
                }

                if (e.Item.FindControl("lblJoinTypeID") != null)
                {
                    ((Label)e.Item.FindControl("lblJoinTypeID")).Text = ((int)PointCondition.JoinTypeID).ToString();
                }
            }
            pointsrecordcount = pointsrecordcount + 1;
        }



        ////Customer Group Link
        //bool include = x.include;
        //long CustomerConditionDetailID = x.CustomerConditionDetailsID;
        //if (include)
        //{


        //  var cusDetail = objOffer.EligibleCustomerGroupConditions.IncludeCondition.Where(p => p.CustomerConditionDetailsID == CustomerConditionDetailID).SingleOrDefault();
        //  if (cusDetail.CustomerGroup.CustomerGroupID > 2 && cusDetail.CustomerGroup.NewCardHolders == false)
        //  {
        //    if (e.Item.FindControl("lnkDetails") != null)
        //      e.Item.FindControl("lnkDetails").Visible = true;

        //  }
        //  else
        //  {
        //    if (e.Item.FindControl("lblDetails") != null)
        //      e.Item.FindControl("lblDetails").Visible = true;
        //  }
        //  pointsrecordcount = pointsrecordcount + 1;

        //}
        //else
        //{
        //  var cusDetail = objOffer.EligibleCustomerGroupConditions.ExcludeCondition.Where(p => p.CustomerConditionDetailsID == CustomerConditionDetailID).SingleOrDefault();
        //  if (cusDetail.CustomerGroup.CustomerGroupID > 2 && cusDetail.CustomerGroup.NewCardHolders == false)
        //  {
        //    if (e.Item.FindControl("lnkDetails") != null)
        //    {
        //      e.Item.FindControl("lnkDetails").Visible = true;
        //      e.Item.FindControl("lblDetails").Visible = true;
        //      (e.Item.FindControl("lblDetails") as Label).Text = "excluding ";
        //    }
        //  }
        //  else
        //  {
        //    if (e.Item.FindControl("lblDetails") != null)
        //    {
        //      e.Item.FindControl("lblDetails").Visible = true;
        //      (e.Item.FindControl("lblDetails") as Label).Text = "excluding " + (e.Item.FindControl("lblDetails") as Label).Text;
        //    }
        //  }

        //}
    }
Esempio n. 4
0
 private void SetValues(CMS.AMS.Models.PointsCondition OfferEligibilePointsCondition)
 {
     txtValueNeeded.Text      = OfferEligibilePointsCondition.Quantity.ToString();
     chkDisallow_Edit.Checked = OfferEligibilePointsCondition.DisallowEdit;
 }