Exemplo n.º 1
0
        public MD_SuccMatrixList getSuccMatrxList(bool Interna, CT_Succ_Matrix succ)
        {
            if (succ == null || string.IsNullOrEmpty(succ.PSM_Code_s))
            {
                return(null);
            }
            string[] _id = succ.PSM_Code_s.Split(',');
            Array.Sort(_id);
            MD_SuccMatrixList o = new MD_SuccMatrixList();

            o.SuccMatrixList = new List <CT_Succ_Matrix>();
            for (int i = 0; i < _id.Length; i++)
            {
                CT_Succ_Matrix _o = Event.getSuccMatrxList(int.Parse(_id[i]), succ.SMV_CG_Code, succ.SMV_Type);
                if (!Interna && _o != null)
                {
                    _o.PSM_Desc_EN = _o.PSM_Desc_CN;
                }
                if (_o != null)
                {
                    o.SuccMatrixList.Add(_o);
                }
            }
            return(o);
        }
Exemplo n.º 2
0
    public static MD_SuccMatrixList getSuccMatrx_s(int Code, string Code_s)
    {
        BL_Event       Event = new BL_Event();
        CT_Succ_Matrix succ  = new CT_Succ_Matrix {
            PSM_Code_s = Code_s, SMV_CG_Code = Code, SMV_Type = 2
        };

        return(Event.getSuccMatrxList(Inter, succ));
    }
Exemplo n.º 3
0
        public CT_Succ_Matrix getSuccMatrxList(int PSM_Code, int SMV_CG_Code, int SMV_Type)
        {
            string  sqlSuccMatrix = @"Select * from CT_Succ_Matrix inner join CT_SM_Values on PSM_Code=SMV_PSM_Code
                                        where  PSM_Code =" + PSM_Code + " and SMV_CG_Code=" + SMV_CG_Code + " and SMV_Type=" + SMV_Type + ";";
            DataSet ds            = SqlHelper.ExecuteDataset(CommandType.Text, sqlSuccMatrix);

            if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count <= 0)
            {
                sqlSuccMatrix = @"select * from CT_Succ_Matrix where PSM_Code=" + PSM_Code + ";";
                ds            = SqlHelper.ExecuteDataset(CommandType.Text, sqlSuccMatrix);
            }

            CT_Succ_Matrix o = DataHelper.ConvertToObject <CT_Succ_Matrix>(ds);

            return(o);
        }
Exemplo n.º 4
0
    private void Update_Campaign()
    {
        #region 接收参数
        int    intID    = RequestClass.GetInt("id", 0);
        string strTitle = Microsoft.JScript.GlobalObject.unescape(RequestClass.GetString("strTitle")).Replace("'", "").Trim();
        string strDesc  = Microsoft.JScript.GlobalObject.unescape(RequestClass.GetString("strDesc")).Replace("'", "").Trim();
        string PL_Code  = RequestClass.GetString("PL_Code");
        string PL_Val   = Microsoft.JScript.GlobalObject.unescape(RequestClass.GetString("PL_Val")).Replace("'", "").Trim();

        string   Share        = RequestClass.GetString("Share");
        int      Active       = int.Parse(RequestClass.GetString("Active"));
        int      intType      = RequestClass.GetInt("intType", 0);
        int      intType_Time = RequestClass.GetInt("intType_Time", 0);
        DateTime dtSt         = RequestClass.GetFormDateTime("strdtSt");
        DateTime dtEt         = RequestClass.GetFormDateTime("strdtEt");

        string strMothod   = RequestClass.GetString("strMothod").Replace("'", "").Trim();
        int    textMethods = RequestClass.GetInt("textMethods", 0);

        int intWhom     = RequestClass.GetInt("intPerson", 0);
        int intTargeted = RequestClass.GetInt("intTargeted", 0);
        int intcodeVal  = RequestClass.GetInt("intcodeVal", 0);
        //int intSucc = RequestClass.GetInt("intSucc", 0);
        string intSucc = Microsoft.JScript.GlobalObject.unescape(RequestClass.GetString("intSucc")).Replace("'", "").Trim();

        string strFileNameAll = Microsoft.JScript.GlobalObject.unescape(RequestClass.GetString("strFileNameAll")).Replace("'", "").Trim();

        string            o_succ = Microsoft.JScript.GlobalObject.unescape(RequestClass.GetString("o_succ")).Replace("'", "").Trim();
        MD_SuccMatrixList o      = new MD_SuccMatrixList();
        o.SuccMatrixList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <CT_Succ_Matrix> >(o_succ);
        #endregion
        if (0 >= intID || 0 >= strTitle.Length || 0 >= strDesc.Length || (0 == intType_Time && (1900 == dtSt.Year ||
                                                                                                1900 == dtEt.Year)) || 1 >= strMothod.Length || 0 == intTargeted || 1 >= strFileNameAll.Length)
        {
            //参数 没有全填写
            Response.Write("-2");
        }
        else
        {
            strMothod = strMothod.Substring(0, strMothod.Length - 1);
            #region 参数
            SqlParameter[] parameters =
            {
                new SqlParameter("@results",           SqlDbType.Int,         4),
                new SqlParameter("@CG_Code",           SqlDbType.Int,         4),
                new SqlParameter("@CG_Title",          SqlDbType.NVarChar,   50),
                new SqlParameter("@CG_Desc",           SqlDbType.NVarChar,  250),
                new SqlParameter("@CG_Type",           SqlDbType.TinyInt,     4),
                new SqlParameter("@CG_Type_Frequency", SqlDbType.TinyInt,     4),
                new SqlParameter("@CG_Method",         SqlDbType.NVarChar,  100),
                new SqlParameter("@CG_Whom",           SqlDbType.TinyInt,     4),
                new SqlParameter("@CG_Filename",       SqlDbType.NVarChar,  500),
                new SqlParameter("@CG_Start_Dt",       SqlDbType.DateTime),
                new SqlParameter("@CG_End_Dt",         SqlDbType.DateTime),
                new SqlParameter("@CG_Succ_Matrix",    SqlDbType.NVarChar,   80),
                new SqlParameter("@CG_AD_OM_Code",     SqlDbType.TinyInt,     4),
                new SqlParameter("@CG_RP_Code",        SqlDbType.Int,         4),
                new SqlParameter("@PL_Code",           SqlDbType.NVarChar),
                new SqlParameter("@Pl_Val",            SqlDbType.NVarChar),
                new SqlParameter("@CG_UType",          SqlDbType.Int,         4),
                new SqlParameter("@Share",             SqlDbType.Bit),
                new SqlParameter("@AU_Code",           SqlDbType.Int,         4),
                new SqlParameter("@Active",            SqlDbType.Int,         4),
                new SqlParameter("@textMethods",       SqlDbType.Int,         4),
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = intID;
            parameters[2].Value     = strTitle;
            parameters[3].Value     = strDesc;
            parameters[4].Value     = intType;
            parameters[5].Value     = intType_Time;
            parameters[6].Value     = strMothod;
            parameters[7].Value     = intWhom;
            parameters[8].Value     = strFileNameAll;
            parameters[9].Value     = dtSt;
            parameters[10].Value    = dtEt;
            parameters[11].Value    = intSucc;
            parameters[12].Value    = UserSession.DealerEmpl.DE_AD_OM_Code;
            parameters[13].Value    = intTargeted;
            parameters[14].Value    = PL_Code;
            parameters[15].Value    = PL_Val;
            parameters[16].Value    = UserSession.User.UG_UType;
            parameters[17].Value    = Convert.ToByte(Share);
            parameters[18].Value    = UserSession.User.AU_Code;
            parameters[19].Value    = Active;
            parameters[20].Value    = textMethods;
            #endregion
            SqlConnection _c = new SqlConnection(Tools.GetConnString());
            _c.Open();
            SqlTransaction _t = _c.BeginTransaction();

            try
            {
                int i = SqlHelper.ExecuteNonQuery(_t, CommandType.StoredProcedure, "CT_Campaigns_Modify", parameters);
                //Succ的操作
                if (i > 0)
                {
                    int _id = intID;
                    SqlHelper.ExecuteNonQuery(_t, CommandType.Text,
                                              "delete from CT_SM_Values where SMV_Type=1 and SMV_CG_Code=" + _id + ";");
                    for (int j = 0; j < o.SuccMatrixList.Count; j++)
                    {
                        CT_Succ_Matrix _o = o.SuccMatrixList[j];
                        SqlHelper.ExecuteNonQuery(_t, CommandType.Text,
                                                  "insert into CT_SM_Values values(" + _o.PSM_Code + ",1," + _id + "," + _o.SMV_Days + "," + _o.SMV_Val + ");");
                    }
                }
                _t.Commit();
                _c.Close();
            }
            catch { _t.Rollback(); _c.Close(); }
            Response.Write(parameters[0].Value.ToString());
        }
    }
Exemplo n.º 5
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); }
        }