Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ("1" == Request.QueryString["unsync"])
            {
                int nId = 0;
                if (!int.TryParse(Request.QueryString["eventId"], out nId))
                {
                    nId = 0;
                }
                if (0 != nId)
                {
                    // Send WCF Request: CompleteCampaignEventRequest
                    try
                    {
                        ServiceManager sm = new ServiceManager();
                        using (LP2ServiceClient service = sm.StartServiceClient())
                        {
                            CompleteCampaignEventRequest req = new CompleteCampaignEventRequest();
                            ReqHdr hdr = new ReqHdr();
                            hdr.UserId     = CurrUser.iUserID;
                            req.hdr        = hdr;
                            req.FileId     = 0;
                            req.CampaignId = 0;
                            req.EventId    = 0;

                            CompleteCampaignEventResponse uResponse;
                            uResponse = service.CompleteCampaignEvent(req);
                            if (uResponse.hdr.Successful)
                            {
                                if (lmeMngr.CompleteLoanMarketingEvent(nId))
                                {
                                    Response.Write("");
                                }
                                else
                                {
                                    Response.Write("Failed to complete campaign event.");
                                }
                            }
                            else
                            {
                                string strMsg = "Failed to complete campaign event, reason: " + uResponse.hdr.StatusInfo;
                                LPLog.LogMessage(LogType.Logerror, strMsg);
                                Response.Write(strMsg);
                            }
                        }
                    }
                    catch (System.ServiceModel.EndpointNotFoundException ee)
                    {
                        LPLog.LogMessage(LogType.Logerror, ee.Message);
                        Response.Write("Failed to complete campaign event, reason: Marketing Manager is not running.");
                    }
                    catch (Exception ex)
                    {
                        string strMsg = "Failed to complete campaign event, reason: " + ex.Message;
                        LPLog.LogMessage(LogType.Logerror, strMsg);
                        Response.Write(strMsg);
                    }
                }
                Response.End();
            }

            if (Request.Url != null)
            {
                FromURL = Request.Url.ToString();
            }

            if (!IsPostBack)
            {
                // binding categories drop down list
                BLL.MarketingCategory marketingCategory = new BLL.MarketingCategory();
                DataSet dsCategories = marketingCategory.GetListInAlphOrder(" CategoryId IN (SELECT b.CategoryId FROM LoanMarketing a INNER JOIN MarketingCampaigns b ON a.CampaignId=b.CampaignId)");
                this.ddlCategories.DataSource = dsCategories;
                this.ddlCategories.DataBind();
                this.ddlCategories.Items.Insert(0, new ListItem("All Categories", "0"));

                // binding campaigns drop down list
                BLL.MarketingCampaigns marketingCampaignsMngr = new BLL.MarketingCampaigns();
                DataSet dsCampaigns = marketingCampaignsMngr.GetListInAlphOrder(" CampaignId IN (SELECT DISTINCT CampaignId FROM LoanMarketing)");
                this.ddlCampaigns.DataSource = dsCampaigns;
                this.ddlCampaigns.DataBind();
                this.ddlCampaigns.Items.Insert(0, new ListItem("All Campaigns", "0"));
                if (null != Request.QueryString["CampaignId"])
                {
                    ListItem item = this.ddlCampaigns.Items.FindByValue(Request.QueryString["CampaignId"]);
                    if (null != item)
                    {
                        item.Selected = true;
                    }
                }

                // binding started by user drop down list
                DataSet dsStartedBy = lmeMngr.GetStartedByUserOfLoanMarketing("");
                this.ddlStartBy.DataSource = dsStartedBy;
                this.ddlStartBy.DataBind();
                this.ddlStartBy.Items.Insert(0, new ListItem("Started By", "0"));

                BindGrid();
            }
        }