Ejemplo n.º 1
0
 private void GetQueryStrings()
 {
     OfferID     = Request.QueryString["OfferID"].ConvertToLong();
     ConditionID = Request.QueryString["ConditionID"].ConvertToLong();
     bEnableRestrictedAccessToUEOfferBuilder = MyCommon.Fetch_SystemOption(249) == "1" ? true : false;
     isTranslatedOffer = MyCommon.IsTranslatedUEOffer(Convert.ToInt32(OfferID), MyCommon);
     bEnableAdditionalLockoutRestrictionsOnOffers = MyCommon.Fetch_SystemOption(260) == "1" ? true : false;
     bOfferEditable     = MyCommon.IsOfferEditablePastLockOutPeriod(CurrentUser.UserPermissions.EditOfferPastLockoutPeriod, MyCommon, Convert.ToInt32(OfferID));
     bExpireDateEnabled = SystemCacheData.GetSystemOption_General_ByOptionId(TRACKABLE_COUPON_EXPIRE_DATE_SYSOPTION_ID).Equals("1");
 }
Ejemplo n.º 2
0
    private void FetchData(int pageIndex)
    {
        AMSResult <List <TrackableCouponView> > listTCPmodel;

        trackableCouponProgram = CurrentRequest.Resolver.Resolve <ITrackableCouponService>();


        listTCPmodel = trackableCouponProgram.SearchTrackableCouponByCode(pageIndex, 10, sortingText, searchParam, out RecordCount);

        if (listTCPmodel.ResultType != AMSResultType.Success)
        {
            DisplayError(listTCPmodel.GetLocalizedMessage(LanguageID));
            gvCouponList.DataSource = null;
            gvCouponList.DataBind();

            EnableButton(false);
            return;
        }
        gvCouponList.Columns[1].HeaderText = PhraseLib.Lookup("term.couponcodeupc", LanguageID);
        //gvCouponList.Columns[2].HeaderText = PhraseLib.Lookup("term.programid", LanguageID);
        gvCouponList.Columns[3].HeaderText = PhraseLib.Lookup("term.programname", LanguageID);
        gvCouponList.Columns[5].HeaderText = PhraseLib.Lookup("term.originaluses", LanguageID);
        gvCouponList.Columns[4].HeaderText = PhraseLib.Lookup("tcinquiry.RemainingUses", LanguageID);
        gvCouponList.Columns[6].HeaderText = PhraseLib.Lookup("storedvalue.expiredate", LanguageID);
        gvCouponList.Columns[7].HeaderText = PhraseLib.Lookup("term.status", LanguageID);
        gvCouponList.Columns[9].HeaderText = PhraseLib.Lookup("term.history", LanguageID);

        bExpireDateEnabled = SystemCacheData.GetSystemOption_General_ByOptionId(TRACKABLE_COUPON_EXPIRE_DATE_SYSOPTION_ID).Equals("0") ? false : true;
        if (bExpireDateEnabled)
        {
            gvCouponList.Columns[6].Visible = true;
        }

        gvCouponList.DataSource = listTCPmodel.Result;
        gvCouponList.DataBind();
        if (listTCPmodel.Result.Count <= 0)
        {
            EnableButton(false);
        }
        else
        {
            hidLockStatus.Value = ((TrackableCouponView)listTCPmodel.Result[0]).Locked.ToString();
            EnableButton(true);
        }
    }
Ejemplo n.º 3
0
    private void FillPageControlText(TrackableCouponProgram tcProgram)
    {
        Copient.CommonInc MyCommon = new Copient.CommonInc();
        #region LabelsNeverbeChange
        btnSave.Text = PhraseLib.Lookup("term.save", LanguageID);
        hidentification.InnerText = Collapsadividentification.ToolTip = PhraseLib.Lookup("term.identification", LanguageID);
        btnUpdate.Text            = PhraseLib.Lookup("term.save", LanguageID);
        btnNew.Text                               = PhraseLib.Lookup("term.new", LanguageID);
        btnDelete.Text                            = PhraseLib.Lookup("term.delete", LanguageID);
        lblExternalID.Text                        = String.Concat(PhraseLib.Lookup("term.externalid", LanguageID), ":");
        lblName.Text                              = String.Concat(PhraseLib.Lookup("term.name", LanguageID), ":");
        lblDescription.Text                       = String.Concat(PhraseLib.Lookup("term.description", LanguageID), ":");
        lblDescriptionLimitMsg.Text               = String.Concat("(", PhraseLib.Lookup("CPEoffergen.description", LanguageID), ")");
        hRedemptioninformation.InnerText          = CollapsadivRedemptioninformation.ToolTip = PhraseLib.Lookup("term.redemptioninfo", LanguageID);
        lblMaxRedempCount.Text                    = String.Concat(PhraseLib.Lookup("term.maxredemptioncount", LanguageID), ":");
        lblMaxMinInfoMsg.Text                     = String.Concat(PhraseLib.Lookup("term.minimum", LanguageID), ":1", " ", PhraseLib.Lookup("term.maximum", LanguageID), ":255");
        lblExpire.Text                            = String.Concat(PhraseLib.Lookup("storedvalue.expiredate", LanguageID), ":");
        hCouponUploadSumm.InnerText               = CollapsableDivCouponUploadSumm.ToolTip = PhraseLib.Lookup("tcpedit.associatedcoupons", LanguageID);
        hAssociatedoffer.InnerText                = CollapsableDivAssociatedoffer.ToolTip = PhraseLib.Lookup("term.associatedoffers", LanguageID);
        lblLastUpload.Text                        = PhraseLib.Lookup("term.lastupload", LanguageID) + ":";
        btnAction.Text                            = PhraseLib.Lookup("term.actions", LanguageID) + " ▼";
        lblCouponusCount.Text                     = PhraseLib.Lookup("tcpedit.couponscount", LanguageID) + ": ";
        lblExpire.Text                            = String.Concat(PhraseLib.Lookup("storedvalue.expiredate", LanguageID), ":");
        requirefieldName.ErrorMessage             = PhraseLib.Lookup("tcpedit.invalidname", LanguageID);
        requirefieldExternalID.ErrorMessage       = PhraseLib.Lookup("tcpedit.invalidexternalprogramid", LanguageID);
        DescriptionLengthValidator.ErrorMessage   = PhraseLib.Lookup("CPEoffergen.description", LanguageID);
        RangeValidatorMaxRedempCount.ErrorMessage = PhraseLib.Lookup("tcpedit.invalidredeemcount", LanguageID);
        requirefieldMaxRedempCount.ErrorMessage   = PhraseLib.Lookup("tcpedit.blankredemptioninfoerror", LanguageID);
        hExpiration.InnerText                     = PhraseLib.Lookup("term.expiration", LanguageID);
        lblExpirationType.Text                    = PhraseLib.Lookup("storedvalue.expiretype", LanguageID) + ": ";
        lblExpirationPeriodType.Text              = PhraseLib.Lookup("storedvalue.expireperiodtype", LanguageID) + ": ";
        lblExpirationPeriod.Text                  = PhraseLib.Lookup("storedvalue.expireperiod", LanguageID) + ": ";
        lblExpirationDatePicker.Text              = PhraseLib.Lookup("storedvalue.expiredate", LanguageID) + ": ";
        lblExpirationTime.Text                    = PhraseLib.Lookup("storedvalue.expiretime", LanguageID) + ": ";
        rvExpirePeriod.ErrorMessage               = PhraseLib.Lookup("sv-edit.InvalidExpirePeriod", LanguageID);
        FillExpireType();
        FillExpirePeriodType();
        FillExpireTime();

        #endregion

        ProgramID         = tcProgram == null ? "0" : tcProgram.ProgramID.ToString();
        btnSave.Visible   = tcProgram == null ? true : false;
        btnAction.Visible = !btnSave.Visible;
        htitle.InnerText  = tcProgram == null?PhraseLib.Lookup("term.new", LanguageID) + " " + PhraseLib.Lookup("term.trackablecouponprogram", LanguageID).ToLower() : PhraseLib.Lookup("term.trackablecouponprogram", LanguageID) + " #" + tcProgram.ProgramID + ": " + tcProgram.Name.TruncateString(15);

        txtName.Text             = tcProgram == null ? String.Empty : tcProgram.Name;
        txtDescription.InnerText = tcProgram == null ? String.Empty : tcProgram.Description.Trim();
        txtExternalID.Text       = tcProgram == null ? String.Empty : tcProgram.ExtProgramID;
        ExpireDate.Text          = (tcProgram == null || tcProgram.ExpireDate == null) ? PhraseLib.Lookup("tcpedit.expiredatenotset", LanguageID) : tcProgram.ExpireDate.ConvertToDate().ToShortDateString();
        txtMaxRedempCount.Text   = tcProgram == null ? "1" : Convert.ToString(tcProgram.MaxRedeemCount);
        SetLastLoadMessage(tcProgram);
        CouponCount.Text        = tcProgram == null ? "0" : Convert.ToString(tcProgram.AssosiatedCouponCount);
        ucNotesUI.Visible       = tcProgram == null ? false : MyCommon.Fetch_SystemOption(75).Equals("1") ? true : false;
        lblAssociatedOffer.Text = PhraseLib.Lookup("term.none", LanguageID);
        AssociateOfferID        = String.Empty;

        bExpireDateEnabled                 = SystemCacheData.GetSystemOption_General_ByOptionId(TRACKABLE_COUPON_EXPIRE_DATE_SYSOPTION_ID).Equals("1");
        ddlExpireTypes.SelectedValue       = ((tcProgram == null) || (!bExpireDateEnabled)) ? "1" : tcProgram.TCExpireType.ToString();
        ddlExpirePeriodTypes.SelectedValue = tcProgram == null ? "0" : tcProgram.TCExpirePeriodType.ToString();
        txtExpirationPeriod.Text           = tcProgram == null ? "0" : tcProgram.ExpirePeriod.ToString();
        ddlExpireTypes_SelectedIndexChanged(this, EventArgs.Empty);
        txtDatepicker.Text = (tcProgram == null || tcProgram.ExpireDate == null) ? "" : ExpireDate.Text;
        ddlExpireTimeHours.SelectedValue   = (tcProgram == null || tcProgram.ExpireDate == null) ? "00" : tcProgram.ExpireDate.Value.Hour.ToString("00");
        ddlExpireTimeMinutes.SelectedValue = (tcProgram == null || tcProgram.ExpireDate == null) ? "00" : tcProgram.ExpireDate.Value.Minute.ToString("00");

        if (bExpireDateEnabled)
        {
            divExpiration.Visible = true;
        }

        if (tcProgram != null)
        {
            List <CMS.AMS.Models.Offer> offersObj = GetAttachedOffersByID(tcProgram.ProgramID);
            if (offersObj != null && offersObj.Count > 0)
            {
                lblAssociatedOffer.Text = String.Empty;
                offerService            = CurrentRequest.Resolver.Resolve <IOffer>();
                foreach (var item in offersObj)
                {
                    AssociateOfferID = item.OfferID.ToString();
                    if (SystemCacheData.GetSystemOption_General_ByOptionId(66) == "1")
                    {
                        AMSResult <bool> ResultObj = offerService.IsAccessibleBannerEnabledOffer(CurrentUser.AdminUser.ID, item.OfferID);
                        if (ResultObj.ResultType != AMSResultType.Success)
                        {
                            DisplayError(ResultObj.GetLocalizedMessage <bool>(LanguageID));
                            return;
                        }
                        if (ResultObj.Result)
                        {
                            lblAssociatedOffer.Text += "<a href='offer-redirect.aspx?OfferID=" + item.OfferID + "'>" + item.OfferName + "</a>" + "</br>";
                        }
                        else
                        {
                            lblAssociatedOffer.Text += item.OfferName + "</br>";
                        }
                    }
                    else
                    {
                        lblAssociatedOffer.Text += "<a href='offer-redirect.aspx?OfferID=" + item.OfferID + "'>" + item.OfferName + "</a>" + "</br>";
                    }
                }
            }
        }
    }