Пример #1
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool ModDataMyCollector(XBase.Model.Decision.DataMyCollector entity)
        {
            SqlParameter[] parameters = new SqlParameter[] {
                SqlParameterHelper.MakeInParam("@ID", SqlDbType.Int, 4, entity.ID),
                SqlParameterHelper.MakeInParam("@Flag", SqlDbType.Char, 1, entity.Flag),
                SqlParameterHelper.MakeInParam("@ReadStatus", SqlDbType.Char, 1, entity.ReadStatus),
                SqlParameterHelper.MakeInParam("@ReadDate", SqlDbType.DateTime, 8, entity.ReadDate)
            };
            bool ret;

            Database.RunProc("[statdba].DataMyCollector_Mod", parameters, out ret);
            return(ret);
        }
Пример #2
0
 /// <summary>
 /// 添加一个实体类
 /// </summary>
 /// <param name="dr"></param>
 /// <returns></returns>
 private XBase.Model.Decision.DataMyCollector GetList(SqlDataReader dr)
 {
     XBase.Model.Decision.DataMyCollector entity = new XBase.Model.Decision.DataMyCollector();
     entity.ID = SqlClientUtility.GetInt32(dr, "ID", 0);
     entity.KeyWordID = SqlClientUtility.GetInt32(dr, "KeyWordID", 0);
     entity.ActionID = SqlClientUtility.GetInt32(dr, "ActionID", 0);
     entity.ActionDetailID = SqlClientUtility.GetInt32(dr, "ActionDetailID", 0);
     entity.Frequency = SqlClientUtility.GetInt32(dr, "Frequency", 0);
     entity.CompanyCD = SqlClientUtility.GetString(dr, "CompanyCD", String.Empty);
     entity.Flag = SqlClientUtility.GetString(dr, "Flag", String.Empty);
     entity.Owner = SqlClientUtility.GetString(dr, "Owner", String.Empty);
     entity.ReportDate = SqlClientUtility.GetDateTime(dr, "ReportDate", DateTime.Now);
     entity.ReadStatus = SqlClientUtility.GetString(dr, "ReadStatus", String.Empty);
     entity.ReadDate = SqlClientUtility.GetDateTime(dr, "ReadDate", DateTime.Now);
     entity.ReportTxt = SqlClientUtility.GetString(dr, "ReportTxt", String.Empty);
     return entity;
 }
Пример #3
0
 /// <summary>
 /// 添加一个实体类
 /// </summary>
 /// <param name="dr"></param>
 /// <returns></returns>
 private XBase.Model.Decision.DataMyCollector GetList(SqlDataReader dr)
 {
     XBase.Model.Decision.DataMyCollector entity = new XBase.Model.Decision.DataMyCollector();
     entity.ID             = SqlClientUtility.GetInt32(dr, "ID", 0);
     entity.KeyWordID      = SqlClientUtility.GetInt32(dr, "KeyWordID", 0);
     entity.ActionID       = SqlClientUtility.GetInt32(dr, "ActionID", 0);
     entity.ActionDetailID = SqlClientUtility.GetInt32(dr, "ActionDetailID", 0);
     entity.Frequency      = SqlClientUtility.GetInt32(dr, "Frequency", 0);
     entity.CompanyCD      = SqlClientUtility.GetString(dr, "CompanyCD", String.Empty);
     entity.Flag           = SqlClientUtility.GetString(dr, "Flag", String.Empty);
     entity.Owner          = SqlClientUtility.GetString(dr, "Owner", String.Empty);
     entity.ReportDate     = SqlClientUtility.GetDateTime(dr, "ReportDate", DateTime.Now);
     entity.ReadStatus     = SqlClientUtility.GetString(dr, "ReadStatus", String.Empty);
     entity.ReadDate       = SqlClientUtility.GetDateTime(dr, "ReadDate", DateTime.Now);
     entity.ReportTxt      = SqlClientUtility.GetString(dr, "ReportTxt", String.Empty);
     return(entity);
 }
Пример #4
0
        /// <summary>
        /// 条件查询
        /// </summary>
        /// <param name="cond">查询条件,多个条件应该以And连接</param>
        /// <param name="orderExp">展现顺序</param>
        /// <returns>List</returns>
        public IList <XBase.Model.Decision.DataMyCollector> GetDataMyCollectorListbyCond(string cond, string orderExp)
        {
            SqlParameter[] parameters = new SqlParameter[] {
                SqlParameterHelper.MakeInParam("@Where", SqlDbType.VarChar, 100, cond),
                SqlParameterHelper.MakeInParam("@OrderExp", SqlDbType.VarChar, 50, orderExp)
            };
            XBase.Model.Decision.DataMyCollector        entity = null;
            List <XBase.Model.Decision.DataMyCollector> lst    = new List <XBase.Model.Decision.DataMyCollector>();
            SqlDataReader dr;

            Database.RunProc("statdba.DataMyCollector_SelectbyCond", parameters, out dr);
            while (dr.Read())
            {
                entity = GetList(dr);
                lst.Add(entity);
            }
            return(lst);
        }
Пример #5
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool AddDataMyCollector(XBase.Model.Decision.DataMyCollector entity)
        {
            SqlParameter[] parameters = new SqlParameter[] {
                SqlParameterHelper.MakeInParam("@KeyWordID", SqlDbType.Int, 4, entity.KeyWordID),
                SqlParameterHelper.MakeInParam("@ActionID", SqlDbType.Int, 4, entity.ActionID),
                SqlParameterHelper.MakeInParam("@ActionDetailID", SqlDbType.Int, 4, entity.ActionDetailID),
                SqlParameterHelper.MakeInParam("@Frequency", SqlDbType.Int, 4, entity.Frequency),
                SqlParameterHelper.MakeInParam("@CompanyCD", SqlDbType.VarChar, 8, entity.CompanyCD),
                SqlParameterHelper.MakeInParam("@Flag", SqlDbType.Char, 1, entity.Flag),
                SqlParameterHelper.MakeInParam("@ReportDate", SqlDbType.DateTime, 8, entity.ReportDate),
                SqlParameterHelper.MakeInParam("@Owner", SqlDbType.VarChar, 20, entity.Owner),
                SqlParameterHelper.MakeInParam("@ReportTxt", SqlDbType.NVarChar, 200, entity.ReportTxt),
                SqlParameterHelper.MakeInParam("@ReadStatus", SqlDbType.Char, 1, entity.ReadStatus)
            };
            bool ret;

            Database.RunProc("[statdba].DataMyCollector_Add", parameters, out ret);
            return(ret);
        }
Пример #6
0
        public void DataStatSend(DateTime lastEndDate, string Frequency)
        {
            try
            {
                string  strPro      = String.Empty;
                string  strSqlwhere = String.Empty;
                DataSet ds          = null;
                XBase.Data.Decision.DataMySubscribe _dal = new DataMySubscribe();
                _list = _dal.GetDataMySubscribleListbyCond("Frequency='" + Frequency + "'", "ID");
                for (int i = 0; i < _list.Count; i++)
                {
                    if (_list[i].DataVarValue != "" && _list[i].DataVarValue != null)
                    {
                        strSqlwhere = _list[i].DataVarValue;
                    }

                    if (strSqlwhere != "")
                    {
                        SqlParameter[] prams =
                        {
                            SqlParameterHelper.MakeInParam("@LastEndDate", SqlDbType.DateTime, 20, Convert.ToDateTime(lastEndDate))
                        };
                        try{
                            ds = Database.RunSql(strSqlwhere, prams);
                            if (ds != null)
                            {
                                if (ds.Tables[0].Rows[0][0] != null)
                                {
                                    if (ds.Tables[0].Rows[0][0].ToString() != "")
                                    {
                                        string[] MobileArr = _list[i].MyMobile.Split(',');
                                        string   DataName1 = _list[i].DataName;
                                        string   SetResult = Regex.Replace(DataName1, @"<(.[^>]*)>", "", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Replace("&nbsp;", "");
                                        SetResult += _list[i].Format.ToString().Replace("[#统计数据#]", ds.Tables[0].Rows[0][0].ToString());
                                        for (int n = 0; n < MobileArr.Length; n++)
                                        {
                                            XBase.Common.SMSender.InternalSend(MobileArr[n], SetResult + "(统计时间:" + lastEndDate + "---" + DateTime.Now.ToString() + ")");
                                        }

                                        XBase.Model.Decision.DataMyCollector collmodel = new XBase.Model.Decision.DataMyCollector();
                                        string[] IdArr = _list[i].DataID.Split('|');
                                        collmodel.CompanyCD      = _list[i].CompanyCD;
                                        collmodel.KeyWordID      = Convert.ToInt32(IdArr[0]);
                                        collmodel.ActionID       = Convert.ToInt32(IdArr[1]);
                                        collmodel.Frequency      = int.Parse(Frequency);
                                        collmodel.ActionDetailID = Convert.ToInt32(IdArr[2]);
                                        collmodel.Flag           = "1";
                                        collmodel.ReportDate     = DateTime.Now;
                                        collmodel.ReadStatus     = "0";
                                        collmodel.Owner          = "";
                                        collmodel.ReportTxt      = SetResult;
                                        XBase.Data.Decision.DataMyCollector colldata = new XBase.Data.Decision.DataMyCollector();
                                        colldata.AddDataMyCollector(collmodel);
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch
            {
            }
        }
Пример #7
0
        public void DataStatSend(DateTime lastEndDate,string Frequency)
        {
            try
            {
                string strPro = String.Empty;
                string strSqlwhere = String.Empty;
                DataSet ds = null;
                XBase.Data.Decision.DataMySubscribe _dal = new DataMySubscribe();
                _list = _dal.GetDataMySubscribleListbyCond("Frequency='" + Frequency + "'", "ID");
                for (int i = 0; i < _list.Count; i++)
                {

                    if (_list[i].DataVarValue != "" && _list[i].DataVarValue != null)
                        strSqlwhere = _list[i].DataVarValue;

                    if (strSqlwhere != "")
                    {
                        SqlParameter[] prams = {
				            SqlParameterHelper.MakeInParam("@LastEndDate",SqlDbType.DateTime,20,Convert.ToDateTime(lastEndDate))
                        };
                    try{
                            ds= Database.RunSql(strSqlwhere,prams);
                            if (ds!=null)
                            { 
                               
                                if (ds.Tables[0].Rows[0][0] != null)
                                {  
                                    if (ds.Tables[0].Rows[0][0].ToString()!="")
                                    {  
                                        string[] MobileArr = _list[i].MyMobile.Split(',');
                                        string DataName1 = _list[i].DataName;
                                        string SetResult = Regex.Replace(DataName1, @"<(.[^>]*)>", "", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Replace("&nbsp;","");
                                        SetResult+= _list[i].Format.ToString().Replace("[#统计数据#]", ds.Tables[0].Rows[0][0].ToString());
                                        for (int n = 0; n < MobileArr.Length; n++)
                                        {
                                            XBase.Common.SMSender.InternalSend(MobileArr[n], SetResult + "(统计时间:" + lastEndDate+"---"+DateTime.Now.ToString()+")");
                                        }

                                        XBase.Model.Decision.DataMyCollector collmodel = new XBase.Model.Decision.DataMyCollector();
                                        string[] IdArr = _list[i].DataID.Split('|');
                                        collmodel.CompanyCD = _list[i].CompanyCD;
                                        collmodel.KeyWordID = Convert.ToInt32(IdArr[0]);
                                        collmodel.ActionID = Convert.ToInt32(IdArr[1]);
                                        collmodel.Frequency = int.Parse(Frequency);
                                        collmodel.ActionDetailID = Convert.ToInt32(IdArr[2]);
                                        collmodel.Flag = "1";
                                        collmodel.ReportDate = DateTime.Now;
                                        collmodel.ReadStatus = "0";
                                        collmodel.Owner = "";
                                        collmodel.ReportTxt = SetResult;
                                        XBase.Data.Decision.DataMyCollector colldata = new XBase.Data.Decision.DataMyCollector();
                                        colldata.AddDataMyCollector(collmodel);
                                    }
                                  
                                }
                            }
                         }
                         catch
                         {

                         }

                    }
                }
            }
            catch
            {

            }
            
        }
Пример #8
0
 public bool ModDataMyCollector(XBase.Model.Decision.DataMyCollector entity)
 {
     return(_dal.ModDataMyCollector(entity));
 }