protected void btnDelete_Click(Object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(AssociateOfferID)) { DisplayError(PhraseLib.Lookup("tcpedit.programused", LanguageID)); return; } tcpService = CurrentRequest.Resolver.Resolve <ITrackableCouponProgramService>(); activityLogService = CurrentRequest.Resolver.Resolve <IActivityLogService>(); AMSResult <bool> retVal = tcpService.DeleteTrackableCouponProgram(Convert.ToInt32(ProgramID)); if (retVal.ResultType != AMSResultType.Success) { DisplayError(retVal.GetLocalizedMessage <bool>(LanguageID)); } else { activityLogService.Activity_Log(ActivityTypes.TCProgram, ProgramID.ConvertToInt32(), CurrentUser.AdminUser.ID, String.Concat(PhraseLib.Lookup("term.trackablecouponprogram", LanguageID), " ", PhraseLib.Lookup("term.deleted", LanguageID))); Response.Redirect("~/logix/tcp-list.aspx", false); } } catch (Exception ex) { DisplayError(ErrorHandler.ProcessError(ex)); } }
private void ResolveDepedencies() { m_TCProgramCondition = CurrentRequest.Resolver.Resolve <CMS.AMS.Contract.ITrackableCouponConditionService>(); m_Offer = CurrentRequest.Resolver.Resolve <CMS.AMS.Contract.IOffer>(); m_TCProgram = CurrentRequest.Resolver.Resolve <ITrackableCouponProgramService>(); m_ActivityLog = CurrentRequest.Resolver.Resolve <IActivityLogService>(); m_OAWService = CurrentRequest.Resolver.Resolve <IOfferApprovalWorkflowService>(); }
private void ResolveDependencies() { CurrentRequest.Resolver.AppName = "UEoffer-rew-tc.aspx"; m_TCProgram = CurrentRequest.Resolver.Resolve <ITrackableCouponProgramService>(); m_OAWService = CurrentRequest.Resolver.Resolve <IOfferApprovalWorkflowService>(); m_CRService = CurrentRequest.Resolver.Resolve <ICouponRewardService>(); m_ActivityLog = CurrentRequest.Resolver.Resolve <IActivityLogService>(); m_Offer = CurrentRequest.Resolver.Resolve <IOffer>(); m_Commondata = CurrentRequest.Resolver.Resolve <CMS.AMS.Common>(); m_CommonInc = CurrentRequest.Resolver.Resolve <CommonInc>(); }
private TrackableCouponProgram GetProgramByID(Int32 pID) { tcpService = CurrentRequest.Resolver.Resolve <ITrackableCouponProgramService>(); AMSResult <TrackableCouponProgram> tcProgram = SystemCacheData.GetSystemOption_UE_ByOptionId(152) == "0" ? tcpService.GetTrackableCouponProgramById(pID) : tcpService.GetTrackableCouponProgramById(pID, true); if (tcProgram.ResultType != AMSResultType.Success) { DisplayError(tcProgram.GetLocalizedMessage <TrackableCouponProgram>(LanguageID)); return(null); } else { return((TrackableCouponProgram)tcProgram.Result); } }
private void FillExpirePeriodType() { tcpService = CurrentRequest.Resolver.Resolve <ITrackableCouponProgramService>(); AMSResult <List <TrackableCouponExpirePeriodType> > lstExpirePeriodTypes = tcpService.GetTrackableCouponExpirePeriodTypes(); if (lstExpirePeriodTypes.ResultType != AMSResultType.Success) { DisplayError(lstExpirePeriodTypes.GetLocalizedMessage <List <TrackableCouponExpirePeriodType> >(LanguageID)); return; } ddlExpirePeriodTypes.DataSource = (from item in lstExpirePeriodTypes.Result select new { Text = PhraseLib.Lookup(item.PhraseID, LanguageID).Replace("'", "'"), Value = item.TCExpirePeriodTypeID.ToString() }).ToList(); ddlExpirePeriodTypes.DataTextField = "Text"; ddlExpirePeriodTypes.DataValueField = "Value"; ddlExpirePeriodTypes.DataBind(); }
private void FetchData(int pageIndex) { AMSResult <List <TrackableCouponProgram> > listTCPmodel; trackableCouponProgram = CurrentRequest.Resolver.Resolve <ITrackableCouponProgramService>(); for (int i = 0; i < gvCouponProgramList.Columns.Count; i++) { switch (i) { case 0: gvCouponProgramList.Columns[i].HeaderText = PhraseLib.Lookup("term.id", LanguageID); break; case 1: gvCouponProgramList.Columns[i].HeaderText = PhraseLib.Lookup("term.name", LanguageID); break; case 2: gvCouponProgramList.Columns[i].HeaderText = PhraseLib.Lookup("storedvalue.expiredate", LanguageID).Replace("'", "'"); break; case 3: gvCouponProgramList.Columns[i].HeaderText = PhraseLib.Lookup("term.created", LanguageID); break; case 4: gvCouponProgramList.Columns[i].HeaderText = PhraseLib.Lookup("term.edited", LanguageID); break; } } listTCPmodel = trackableCouponProgram.GetTrackableCouponPrograms(pageIndex, ListBar1.PageingControl.PageSize, sortingText, ProgramName, ProgramID, out RecordCount); if (listTCPmodel.ResultType != AMSResultType.Success) { DisplayError(listTCPmodel.GetLocalizedMessage(LanguageID)); gvCouponProgramList.DataSource = null; gvCouponProgramList.DataBind(); } else { gvCouponProgramList.DataSource = listTCPmodel.Result; gvCouponProgramList.DataBind(); ListBar1.PageingControl.RecordCount = RecordCount; ListBar1.PageingControl.PageIndex = pageIndex; ListBar1.PageingControl.DataBind(); } }
protected void btnSave_Click(Object sender, EventArgs e) { if (!Page.IsValid) { return; } bool isNew = false; string logMsg = String.Empty; try { tcpService = CurrentRequest.Resolver.Resolve <ITrackableCouponProgramService>(); activityLogService = CurrentRequest.Resolver.Resolve <IActivityLogService>(); if (Convert.ToInt32(ProgramID) == 0) { isNew = true; } TrackableCouponProgram tcProgramModel = new TrackableCouponProgram(); tcProgramModel.ProgramID = Convert.ToInt32(ProgramID); tcProgramModel.Name = txtName.Text.Trim(); tcProgramModel.Description = txtDescription.InnerText.Trim(); tcProgramModel.ExtProgramID = txtExternalID.Text.Trim(); tcProgramModel.MaxRedeemCount = Convert.ToByte(txtMaxRedempCount.Text); tcProgramModel.TCExpireType = Convert.ToInt32(ddlExpireTypes.SelectedValue); int ExpirationPeriod; switch (tcProgramModel.TCExpireType) { case 1: tcProgramModel.ExpirePeriod = 0; tcProgramModel.TCExpirePeriodType = 0; tcProgramModel.ExpireDate = null; break; case 2: DateTime dtSpecified; tcProgramModel.ExpirePeriod = 0; tcProgramModel.TCExpirePeriodType = 0; if (DateTime.TryParse(ExpireDate.Text, out dtSpecified)) { tcProgramModel.ExpireDate = dtSpecified; } else { tcProgramModel.ExpireDate = null; } if (tcProgramModel.ExpireDate < DateTime.Now) { DisplayError(Copient.PhraseLib.Lookup("logix-js.EnterValidExpDate", LanguageID).Replace("'", "\'")); return; } break; case 3: if (!Int32.TryParse(txtExpirationPeriod.Text, out ExpirationPeriod)) { DisplayError(Copient.PhraseLib.Lookup("sv-edit.InvalidExpirePeriod", LanguageID)); return; } tcProgramModel.ExpirePeriod = ExpirationPeriod; tcProgramModel.TCExpirePeriodType = Convert.ToInt32(ddlExpirePeriodTypes.SelectedValue); tcProgramModel.ExpireDate = null; break; case 4: if (!Int32.TryParse(txtExpirationPeriod.Text, out ExpirationPeriod)) { DisplayError(Copient.PhraseLib.Lookup("sv-edit.InvalidExpirePeriod", LanguageID)); return; } tcProgramModel.ExpirePeriod = ExpirationPeriod; tcProgramModel.TCExpirePeriodType = 2; tcProgramModel.ExpireDate = null; break; } AMSResult <bool> retVal = tcpService.CreateUpdateTrackableCouponProgram(tcProgramModel); if (retVal.ResultType != AMSResultType.Success) { DisplayError(retVal.GetLocalizedMessage <bool>(LanguageID)); } else { logMsg = isNew == true?String.Concat(PhraseLib.Lookup("term.trackablecouponprogram", LanguageID), " ", PhraseLib.Lookup("term.created", LanguageID)) : String.Concat(PhraseLib.Lookup("term.trackablecouponprogram", LanguageID), " ", PhraseLib.Lookup("term.edited", LanguageID)); activityLogService.Activity_Log(ActivityTypes.TCProgram, tcProgramModel.ProgramID.ConvertToInt32(), CurrentUser.AdminUser.ID, logMsg); Response.Redirect("~/logix/tcp-edit.aspx?tcprogramid=" + tcProgramModel.ProgramID, false); } } catch (Exception ex) { DisplayError(ErrorHandler.ProcessError(ex)); } }
private void ResolveDepedencies() { m_ActivityLog = CurrentRequest.Resolver.Resolve <IActivityLogService>(); m_TCProgramService = CurrentRequest.Resolver.Resolve <ITrackableCouponProgramService>(); }