Beispiel #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.MarketingCampaigns> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.MarketingCampaigns> modelList = new List <LPWeb.Model.MarketingCampaigns>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.MarketingCampaigns model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.MarketingCampaigns();
                    if (dt.Rows[n]["CampaignId"].ToString() != "")
                    {
                        model.CampaignId = int.Parse(dt.Rows[n]["CampaignId"].ToString());
                    }
                    model.GlobalId     = dt.Rows[n]["GlobalId"].ToString();
                    model.CampaignName = dt.Rows[n]["CampaignName"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LPWeb.Model.MarketingCampaigns model)
 {
     return(dal.Add(model));
 }
Beispiel #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LPWeb.Model.MarketingCampaigns model)
 {
     return(dal.Update(model));
 }
Beispiel #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Request.QueryString["needret"]))
        {
            strNeedReturn = "0";
        }
        else
        {
            strNeedReturn = "1";
        }

        #region 校验必要参数

        bool bIsValid = PageCommon.ValidateQueryString(this, "RuleID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing", "$('#divContainer').hide();alert('Missing required query string.');window.parent.CloseDialog_EditRule();", true);
            return;
        }

        this.iRuleID = Convert.ToInt32(this.Request.QueryString["RuleID"]);

        #endregion

        #region 加载Rule信息
        Template_Rules RuleManager = new Template_Rules();
        DataTable      RuleInfo    = RuleManager.GetRuleInfo(this.iRuleID);
        if (RuleInfo.Rows.Count == 0)
        {
            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Invalid", "$('#divContainer').hide();alert('Invalid required query string.');window.parent.CloseDialog_EditRule();", true);
            return;
        }

        #endregion

        // is referenced by rule group
        this.hdnIsRef.Text = RuleManager.bIsRef(this.iRuleID).ToString();

        if (this.IsPostBack == false)
        {
            #region 加载email template
            LoanTasks      LoanTaskManager  = new LoanTasks();
            Template_Email EmailTempManager = new Template_Email();
            DataTable      EmailTemplates   = EmailTempManager.GetEmailTemplate(" and Enabled = 1");

            DataRow NoneEmailTemplateRow = EmailTemplates.NewRow();
            NoneEmailTemplateRow["TemplEmailId"] = 0;
            NoneEmailTemplateRow["Name"]         = "-- select an email template --";
            EmailTemplates.Rows.InsertAt(NoneEmailTemplateRow, 0);

            this.ddlRecomActionTemplate.DataSource = EmailTemplates;
            this.ddlRecomActionTemplate.DataBind();

            this.ddlAlertEmailTemplate.DataSource = EmailTemplates;
            this.ddlAlertEmailTemplate.DataBind();

            #endregion

            #region 加载Conditions

            DataTable ConditionListData = RuleManager.GetConditionList(this.iRuleID);
            this.gridConditionList.DataSource = ConditionListData;
            this.gridConditionList.DataBind();

            #endregion

            #region 绑定数据

            this.txtRuleName.Text   = RuleInfo.Rows[0]["Name"].ToString();
            this.txtDesc.Text       = RuleInfo.Rows[0]["Desc"].ToString();
            this.chkEnabled.Checked = Convert.ToBoolean(RuleInfo.Rows[0]["Enabled"]);
            this.ddlRecomActionTemplate.SelectedValue = RuleInfo.Rows[0]["RecomEmailTemplid"].ToString();
            this.ddlAlertEmailTemplate.SelectedValue  = RuleInfo.Rows[0]["AlertEmailTemplId"].ToString();
            this.chkReqAck.Checked      = Convert.ToBoolean(RuleInfo.Rows[0]["AckReq"]);
            this.txtFormula.Text        = RuleInfo.Rows[0]["AdvFormula"].ToString();
            this.ddlScope.SelectedValue = RuleInfo.Rows[0]["RuleScope"].ToString();

            #region get loan target

            //this.ddlTarget.SelectedValue = RuleInfo.Rows[0]["LoanTarget"].ToString();

            LPWeb.Model.Template_Rules_LoanTarget modelLoanTarget;
            if (!RuleInfo.Rows[0].IsNull("LoanTarget"))
            {
                modelLoanTarget = new LPWeb.Model.Template_Rules_LoanTarget(Convert.ToInt16(RuleInfo.Rows[0]["LoanTarget"]));
            }
            else
            {
                modelLoanTarget = new LPWeb.Model.Template_Rules_LoanTarget();
            }

            this.chkTargetActiveLoans.Checked   = modelLoanTarget.ActiveLoans;
            this.chkTargetActiveLeads.Checked   = modelLoanTarget.ActiveLeads;
            this.chkTargetArchivedLoans.Checked = modelLoanTarget.ArchivedLoans;
            this.chkTargetArchivedLeads.Checked = modelLoanTarget.ArchivedLeads;

            #endregion

            #endregion
            if (RuleInfo.Rows[0]["AutoCampaignId"].ToString() != "")
            {
                this.hfSelCampaigns.Value = RuleInfo.Rows[0]["AutoCampaignId"].ToString();
                MarketingCampaigns             _bMarketingCampaigns = new MarketingCampaigns();
                LPWeb.Model.MarketingCampaigns _mMarketingCampaigns = _bMarketingCampaigns.GetModel(Convert.ToInt32(RuleInfo.Rows[0]["AutoCampaignId"]));
                //txtMarketingCampaign.Text = _mMarketingCampaigns.CampaignName;
            }
            // set counter
            this.hdnCounter.Value = ConditionListData.Rows.Count.ToString();
        }
    }