Exemple #1
0
        public CT_Events getEvents(int EV_Code)
        {
            string sqlEvents = "select * from CT_Events where EV_Code=" + EV_Code + ";";

            CT_Events o = DataHelper.ConvertToObject <CT_Events>(sqlEvents);

            return(o);
        }
Exemple #2
0
        /// <summary>
        /// 获取插入表CT_History_Campaigns的SQL列表
        /// </summary>
        /// <param name="_c"></param>
        /// <param name="_r"></param>
        /// <param name="_sql"></param>
        /// <param name="runTime"></param>
        /// <param name="UType"></param>
        /// <param name="PV_AD_OM_Code"></param>
        /// <returns></returns>
        private string GetHistorySql_E(CT_Events _e, CT_Reports _r, string _sql, string runTime, int UType, int PV_AD_OM_Code)
        {
            string sql = "INSERT INTO CT_History_Events VALUES(" + _e.EV_Code + ", '"
                         + runTime + "' ," + UType + "," + PV_AD_OM_Code + " ,'" + _e.EV_Start_dt + "' ,'" + _e.EV_End_dt + "' ,'"
                         + _e.EV_Act_S_dt + "' ,'" + _e.EV_Act_E_dt + "' ,'" + _sql + "' ,'" + _r.RP_Name_EN + "' ,'" + _r.RP_Name_CN
                         + "','" + _e.EV_Budget + "' ,'" + _e.EV_Respnsible + "' ,'" + _e.EV_Tools + "');";

            return(sql);
        }
Exemple #3
0
        public int ReportRun(ReportRunParam rParam)
        {
            //-1 代表请求参数为空;
            if (rParam == null)
            {
                return(-1);
            }
            CT_Reports _r;

            if (rParam.pType == 1)
            {
                BL_Campaign    c  = new BL_Campaign();
                CT_Campaigns   _c = c.GetCampaign(rParam.CG_EV_Code);
                CT_Param_Value _p = new CT_Param_Value()
                {
                    RP_Code       = _c.CG_RP_Code,
                    PV_Type       = 1,
                    PV_CG_Code    = _c.CG_Code,
                    PV_UType      = rParam.UType,
                    PV_AD_OM_Code = rParam.AU_AD_OM_Code
                };
                _r = GetReplaceReport(_p);

                List <CRMTreeDatabase.EX_Param> eps = new List <CRMTreeDatabase.EX_Param>();
                CRMTreeDatabase.EX_Param        ep  = new CRMTreeDatabase.EX_Param();
                ep.EX_Name     = "PR";
                ep.EX_Value    = "0";
                ep.EX_DataType = "int";
                eps.Add(ep);
                //var oeps = JsonConvert.SerializeObject(eps);

                _r.RP_Query = GetReportSql(_r.RP_Code, eps).SQL;
                return(_D_re.ReportRun <CT_Campaigns>(_r, _c, rParam.UType, rParam.AU_AD_OM_Code));
            }
            else if (rParam.pType == 2)
            {
                DL_Event       e  = new DL_Event();
                CT_Events      _e = e.getEvents(rParam.CG_EV_Code);
                CT_Param_Value _p = new CT_Param_Value()
                {
                    RP_Code       = _e.EV_RP_Code,
                    PV_Type       = 2,
                    PV_CG_Code    = _e.EV_Code,
                    PV_UType      = rParam.UType,
                    PV_AD_OM_Code = rParam.AU_AD_OM_Code
                };
                _r          = GetReplaceReport(_p);
                _r.RP_Query = GetReportSql(_r.RP_Code, null).SQL;
                return(_D_re.ReportRun <CT_Events>(_r, _e, rParam.UType, rParam.AU_AD_OM_Code));
            }
            return(-1);
        }
    public void event_Modify()
    {
        CT_Events Ev = new CT_Events();

        Ev.EV_UType       = UserSession.User.UG_UType;
        Ev.EV_AD_OM_Code  = UserSession.DealerEmpl.DE_AD_OM_Code;
        Ev.EV_Created_By  = UserSession.User.AU_Code;
        Ev.EV_Updated_By  = UserSession.User.AU_Code;
        Ev.EV_Title       = GlobalObject.unescape(RequestClass.GetString("EV_Title")).Replace("'", "").Trim();
        Ev.EV_Share       = System.Convert.ToBoolean(RequestClass.GetInt("EV_Share", 0));
        Ev.EV_Active_Tag  = RequestClass.GetInt("EV_Active_Tag", 0);
        Ev.EV_Desc        = GlobalObject.unescape(RequestClass.GetString("EV_Desc")).Replace("'", "").Trim();
        Ev.EV_Type        = RequestClass.GetInt("EV_Type", 0);
        Ev.EV_RP_Code     = RequestClass.GetInt("EV_RP_Code", 0);
        Ev.EV_Start_dt    = RequestClass.GetFormDateTime("EV_Start_dt");
        Ev.EV_End_dt      = RequestClass.GetFormDateTime("EV_End_dt");
        Ev.EV_Method      = RequestClass.GetString("EV_Method");
        Ev.EV_Whom        = RequestClass.GetInt("EV_Whom", 0);
        Ev.EV_Mess_Type   = RequestClass.GetInt("EV_Mess_Type", 0);
        Ev.EV_EG_Code     = RequestClass.GetInt("EV_EG_Code", 1);
        Ev.EV_RSVP        = System.Convert.ToBoolean(RequestClass.GetInt("EV_RSVP", 0));
        Ev.EV_Act_S_dt    = RequestClass.GetFormDateTime("EV_Act_S_dt");
        Ev.EV_Act_E_dt    = RequestClass.GetFormDateTime("EV_Act_E_dt");
        Ev.EV_Respnsible  = GlobalObject.unescape(RequestClass.GetString("EV_Respnsible")).Replace("'", "").Trim();
        Ev.EV_Tools       = GlobalObject.unescape(RequestClass.GetString("EV_Tools")).Replace("'", "").Trim();
        Ev.EV_Budget      = RequestClass.GetFormDecimal("EV_Budget", 0);
        Ev.EV_Succ_Matrix = GlobalObject.unescape(RequestClass.GetString("EV_Succ_Matrix")).Replace("'", "").Trim();
        Ev.EV_Filename    = GlobalObject.unescape(RequestClass.GetString("EV_Filename")).Replace(",", "").Trim();
        Ev.EV_TrackFlag   = false;
        Ev.EV_LastRun     = Ev.EV_Act_S_dt;
        Ev.EV_Code        = RequestClass.GetInt("EV_Code", 0);
        Ev.PL_Code_List   = RequestClass.GetString("PL_Code_List");
        Ev.Pl_Val_List    = GlobalObject.unescape(RequestClass.GetString("PL_Val_List")).Replace("'", "").Trim();
        string            o_succ = GlobalObject.unescape(RequestClass.GetString("o_succ")).Replace("'", "").Trim();
        MD_SuccMatrixList o      = new MD_SuccMatrixList();

        o.SuccMatrixList = JsonConvert.DeserializeObject <List <CT_Succ_Matrix> >(o_succ);
        BL_Event events = new BL_Event();
        int      i      = events.ModifyEvent(Ev, o);

        Response.Write(i);
    }
Exemple #5
0
    private void Init_Page()
    {
        int EV_Code = RequestClass.GetInt("id", 0);

        if (EV_Code <= 0)
        {
            Event.EV_Start_dt = DateTime.Now;
            Event.EV_End_dt   = DateTime.Now.AddDays(5);
            Event.EV_Act_S_dt = DateTime.Now;
            Event.EV_Act_E_dt = DateTime.Now.AddDays(5);
        }
        else
        {
            BL_Event Bl_event = new BL_Event();
            Event = Bl_event.getEvents(EV_Code);
            if (Event == null || string.IsNullOrEmpty(Event.EV_Title))
            {
                string str = "<script language=javascript>history.go(-1);</script>";
                Page.RegisterClientScriptBlock("key", str);
            }
        }
    }
Exemple #6
0
        private int EventRun(CT_Events o, CT_Reports R, int UType, int AD_OM_Code)
        {
            DateTime runStarTime = DateTime.Now;
            int      runCount    = 0;
            string   sql         = GetCommSql(UType, AD_OM_Code, R.RP_Query, o.EV_Code, o.EV_Method, runStarTime, 1, out runCount);

            sql += GetHistorySql_E(o, R, sql.Replace("'", "''"), runStarTime.ToString(), UType, AD_OM_Code);
            try
            {
                int i = SqlHelper.ExecuteNonQuery(sql);
                if (i > 0)
                {
                    string Hsql = GetHanderSql(runCount, 1, o.EV_Code, UType, AD_OM_Code, runStarTime);
                    i = SqlHelper.ExecuteNonQuery(Hsql);
                }
                DateTime runEndTime = DateTime.Now;
                return(0);
            }
            catch
            {
                return(-1);
            }
        }
Exemple #7
0
        /// <summary>
        /// 新增一个新的Event
        /// </summary>
        /// <param name="Event"></param>
        /// <returns></returns>
        public int AddEvent(CT_Events Event, MD_SuccMatrixList o_succ)
        {
            #region 参数
            SqlParameter[] parameters = { new SqlParameter("@Results",        SqlDbType.Int,         4),
                                          new SqlParameter("@EV_UType",       SqlDbType.Int,         4),
                                          new SqlParameter("@EV_AD_OM_Code",  SqlDbType.Int,         4),
                                          new SqlParameter("@EV_Share",       SqlDbType.Bit),
                                          new SqlParameter("@EV_Title",       SqlDbType.NVarChar,   50),
                                          new SqlParameter("@EV_Desc",        SqlDbType.NVarChar,  250),
                                          new SqlParameter("@EV_Type",        SqlDbType.Int,         4),
                                          new SqlParameter("@EV_Method",      SqlDbType.NVarChar,  100),
                                          new SqlParameter("@EV_Mess_Type",   SqlDbType.Int,         4),
                                          new SqlParameter("@EV_Whom",        SqlDbType.Int,         4),
                                          new SqlParameter("@EV_RP_Code",     SqlDbType.Int,         4),
                                          new SqlParameter("@EV_Filename",    SqlDbType.NVarChar,  250),
                                          new SqlParameter("@EV_Start_dt",    SqlDbType.DateTime),
                                          new SqlParameter("@EV_End_dt",      SqlDbType.DateTime),
                                          new SqlParameter("@EV_Succ_Matrix", SqlDbType.NVarChar,   80),
                                          new SqlParameter("@EV_TrackFlag",   SqlDbType.Bit),
                                          new SqlParameter("@EV_LastRun",     SqlDbType.DateTime),
                                          new SqlParameter("@EV_Active_Tag",  SqlDbType.Int,         4),
                                          new SqlParameter("@EV_Created_By",  SqlDbType.Int,         4),
                                          new SqlParameter("@EV_Updated_By",  SqlDbType.Int,         4),
                                          new SqlParameter("@EV_EG_Code",     SqlDbType.Int,         4),
                                          new SqlParameter("@EV_RSVP",        SqlDbType.Bit),
                                          new SqlParameter("@EV_Act_S_dt",    SqlDbType.DateTime),
                                          new SqlParameter("@EV_Act_E_dt",    SqlDbType.DateTime),
                                          new SqlParameter("@EV_Respnsible",  SqlDbType.NVarChar,   50),
                                          new SqlParameter("@EV_Budget",      SqlDbType.Money),
                                          new SqlParameter("@EV_Tools",       SqlDbType.NVarChar,   50),
                                          new SqlParameter("@PL_Code_List",   SqlDbType.NVarChar,  500),
                                          new SqlParameter("@Pl_Val_List",    SqlDbType.NVarChar,  500), };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = Event.EV_UType;
            parameters[2].Value     = Event.EV_AD_OM_Code;
            parameters[3].Value     = Event.EV_Share;
            parameters[4].Value     = Event.EV_Title;
            parameters[5].Value     = Event.EV_Desc;
            parameters[6].Value     = Event.EV_Type;
            parameters[7].Value     = Event.EV_Method;
            parameters[8].Value     = Event.EV_Mess_Type;
            parameters[9].Value     = Event.EV_Whom;
            parameters[10].Value    = Event.EV_RP_Code;
            parameters[11].Value    = Event.EV_Filename;
            parameters[12].Value    = Event.EV_Start_dt;
            parameters[13].Value    = Event.EV_End_dt;
            parameters[14].Value    = Event.EV_Succ_Matrix;
            parameters[15].Value    = Event.EV_TrackFlag;
            parameters[16].Value    = Event.EV_LastRun;
            parameters[17].Value    = Event.EV_Active_Tag;
            parameters[18].Value    = Event.EV_Created_By;
            parameters[19].Value    = Event.EV_Updated_By;
            parameters[20].Value    = Event.EV_EG_Code;
            parameters[21].Value    = Event.EV_RSVP;
            parameters[22].Value    = Event.EV_Act_S_dt;
            parameters[23].Value    = Event.EV_Act_E_dt;
            parameters[24].Value    = Event.EV_Respnsible;
            parameters[25].Value    = Event.EV_Budget;
            parameters[26].Value    = Event.EV_Tools;
            parameters[27].Value    = Event.PL_Code_List;
            parameters[28].Value    = Event.Pl_Val_List;
            #endregion
            SqlConnection _c = new SqlConnection(SqlHelper.GetConnectionString());
            _c.Open();
            SqlTransaction _t = _c.BeginTransaction();

            try
            {
                int i = SqlHelper.ExecuteNonQuery(_t, CommandType.StoredProcedure, "EV_Event_Add", parameters);
                //Succ的操作
                if (i > 0)
                {
                    int _id = (int)parameters[0].Value;
                    SqlHelper.ExecuteNonQuery(_t, CommandType.Text,
                                              "delete from CT_SM_Values where SMV_Type=2 and SMV_CG_Code=" + _id + ";");
                    for (int j = 0; j < o_succ.SuccMatrixList.Count; j++)
                    {
                        CT_Succ_Matrix _o = o_succ.SuccMatrixList[j];
                        SqlHelper.ExecuteNonQuery(_t, CommandType.Text,
                                                  "insert into CT_SM_Values values(" + _o.PSM_Code + ",2," + _id + "," + _o.SMV_Days + "," + _o.SMV_Val + ");");
                    }
                }
                _t.Commit();
                _c.Close();
                return(i);
            }
            catch { _t.Rollback(); _c.Close(); return(-1); }
        }
Exemple #8
0
        /// <summary>
        /// 获取Event列表
        /// </summary>
        /// <param name="EV_UType"></param>
        /// <param name="EV_AD_OM_Code"></param>
        /// <param name="primarykey"></param>
        /// <param name="fields"></param>
        /// <param name="ordefiled"></param>
        /// <param name="orderway"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="orderClass"></param>
        /// <returns></returns>
        public string getEventList(bool Interna, MD_UserEntity UserSession, string primarykey, string fields, string ordefiled,
                                   string orderway, int currentpage, int pagesize, string orderClass)
        {
            string        Title       = Interna ? IN_Language.CGL_Title(EM_Language.en_us) : IN_Language.CGL_Title(EM_Language.zh_cn);
            string        Description = Interna ? IN_Language.CGL_Description(EM_Language.en_us) : IN_Language.CGL_Description(EM_Language.zh_cn);
            string        Whom        = Interna ? IN_Language.CGL_Whom(EM_Language.en_us) : IN_Language.CGL_Whom(EM_Language.zh_cn);
            string        Active      = Interna ? IN_Language.CGL_Active(EM_Language.en_us) : IN_Language.CGL_Active(EM_Language.zh_cn);
            string        Update_dt   = Interna ? IN_Language.CGL_Update_dt(EM_Language.en_us) : IN_Language.CGL_Update_dt(EM_Language.zh_cn);
            string        Operate     = Interna ? IN_Language.CGL_Operate(EM_Language.en_us) : IN_Language.CGL_Operate(EM_Language.zh_cn);
            StringBuilder sbList      = new StringBuilder();

            sbList.Append("<table class=\"t-bd\" Style=\"width:930px\"><tr>");
            sbList.Append("<th style=\"cursor:pointer;width:150px;\" ");
            sbList.Append("class=\"w40\" onclick=\"changeOrder(this,'EV_Title')\">" + Title + "<span class=\"taxis\" title=\"Sort by the column \"></span></th>");
            sbList.Append("<th Style=\"width:400px\">" + Description + "</th>");
            sbList.Append("<th>" + Whom + "</th>");
            sbList.Append("<th>" + Active + "</th>");
            sbList.Append("<th style=\"cursor:pointer;\" ");
            if (ordefiled.Equals("EV_Update_dt"))
            {
                sbList.Append("class=\"taxisCurrent\" onclick=\"changeOrder(this,'EV_Update_dt')\">" + Update_dt + "<span class=\"");
                sbList.Append(orderClass);
                sbList.Append("\" title=\"Sort by the column \"></span></th>");
            }
            else
            {
                sbList.Append(" onclick=\"changeOrder(this,'EV_Update_dt')\">" + Update_dt + "<span class=\"taxis\" title=\"Sort by the column \"></span></th>");
            }
            sbList.Append("<th class=\"w100\">" + Operate + "</th>");

            int          pagecount = -1, rowscount = -1;
            MD_EventList EventList = Event.getEventList(UserSession.User.UG_UType, UserSession.DealerEmpl.DE_AD_OM_Code, primarykey, fields, ordefiled,
                                                        orderway, currentpage, pagesize, out pagecount, out rowscount);

            if (null != EventList && EventList.EventList.Count > 0)
            {
                //生成分页html
                var strPager = new StringBuilder();
                if (1 < pagecount)
                {
                    strPager = Pager.JavascriptPagination(true, currentpage, pagecount, rowscount);
                }
                for (int i = 0; i < EventList.EventList.Count; i++)
                {
                    CT_Events Ev = EventList.EventList[i];
                    Ev.Interna = Interna;
                    string     Name   = string.Empty;
                    BL_Reports Report = new BL_Reports();
                    CT_Reports RE     = Report.GetReplaceReport(Interna,
                                                                new CT_Param_Value()
                    {
                        RP_Code = Ev.EV_RP_Code, PV_Type = 2, PV_CG_Code = Ev.EV_Code, PV_UType = UserSession.User.UG_UType, PV_AD_OM_Code = UserSession.DealerEmpl.DE_AD_OM_Code
                    });
                    if (RE == null)
                    {
                        Name = "";
                    }
                    else
                    {
                        Name = RE.RP_Name_EN;
                    }
                    sbList.Append("<tr value='" + Ev.EV_Code + "'><td  style=\"text-align:left\">");
                    sbList.Append(Ev.EV_Title.Length > 30 ? Ev.EV_Title.Substring(0, 30) : Ev.EV_Title);
                    sbList.Append("</td><td  style=\"text-align:left\" title='" + Ev.EV_Desc + "'>");
                    sbList.Append("<div style=\"border-bottom:1px solid #c3c3c3\">");
                    sbList.Append(Ev.EV_Desc.Length > 60 ? Ev.EV_Desc.Substring(0, 60) : Ev.EV_Desc);
                    sbList.Append("</div><div>");
                    sbList.Append(Name.Length > 60 ? Name.Substring(0, 60) : Name);
                    sbList.Append("</div>");
                    sbList.Append("</td><td >");
                    sbList.Append(Ev.S);
                    sbList.Append("</td><td >");
                    sbList.Append(Ev.SS);
                    sbList.Append("</td><td >");
                    sbList.Append(Ev.EV_Update_dt.ToString("MM/dd/yyyy HH:mm:ss"));
                    sbList.Append("</td><td >");
                    sbList.Append("<a href=\"/manage/Event/Edit_Event.aspx?id=");
                    sbList.Append(Ev.EV_Code);
                    sbList.Append("\"><i class=\"btnModify\" title=\"edit\"></i></a>");
                    sbList.Append("<a href=\"javascript:;\"><i class=\"btnDelete\" title=\"Delete\" onclick=\"Delete(event,");
                    sbList.Append(Ev.EV_Code);
                    sbList.Append(",'");
                    sbList.Append(Ev.EV_Filename);
                    sbList.Append("')\"></i></a>");
                    sbList.Append("<a href=\"javascript:;\"><i class=\"btnRun\" title=\"Run\" onclick=\"Run(event,");
                    sbList.Append(Ev.EV_Code);
                    sbList.Append(",");
                    sbList.Append(Ev.EV_RP_Code);
                    sbList.Append(")\"></i></a>");
                    sbList.Append("</td></tr>");
                }
                sbList.Append("</table>");
                sbList.Append(strPager);
            }
            else
            {
                sbList.Append("<tr ><td colspan=\"10\"><div class=\"noData\">No matching data!</div></td></tr>");
                sbList.Append("</tbody>");
                sbList.Append("</table>");
            }
            return(sbList.ToString());
        }
Exemple #9
0
 public int ModifyEvent(CT_Events Events, MD_SuccMatrixList o_succ)
 {
     return(Event.ModifyEvent(Events, o_succ));
 }
Exemple #10
0
 /// <summary>
 /// 更新Event
 /// </summary>
 /// <param name="Events"></param>
 /// <returns></returns>
 public int AddEvent(CT_Events Events, MD_SuccMatrixList o_succ)
 {
     return(Event.AddEvent(Events, o_succ));
 }