예제 #1
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
            {

            }
            
        }
예제 #2
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
            {
            }
        }
예제 #3
0
 public bool AddDataMyCollector(XBase.Model.Decision.DataMyCollector entity)
 {
     return(_dal.AddDataMyCollector(entity));
 }