コード例 #1
0
        public void DeleteModel(PurchaserType purchaser)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from RealTimeUploadRecord  where Purchaser = '" + purchaser.ToString() + "' ");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
コード例 #2
0
        public PolicyRecord GetLastUploadRecored(PurchaserType purchaser, UploadType uType)
        {
            PolicyRecord rec = new PolicyRecord();

            try
            {
                string        strSql = "select top 1 LastUpdateTime,LastPolicyId from UpLoadRecord where IsEnabled=1 and NotifyResult=1 and UploadType='" + uType.ToString() + "' and PurchaserType='" + purchaser.ToString() + "' and IsEnabled =1  ORDER BY CreateTime DESC";
                SqlDataReader reader = DbHelperSQL.ExecuteReader(strSql);
                bool          flag   = false;
                while (reader.Read())
                {
                    flag               = true;
                    rec.LastPolicyId   = long.Parse(reader["LastPolicyId"].ToString());
                    rec.LastUpdateTime = Convert.ToDateTime(reader["LastUpdateTime"]);
                }
                if (!flag)
                {
                    rec = new PolicyRecord()
                    {
                        LastUpdateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 0:00:00"), LastPolicyId = 0
                    };
                }
                reader.Close();
                reader = null;
            }
            catch (Exception ex)
            {
                rec = new PolicyRecord()
                {
                    LastUpdateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 0:00:00"), LastPolicyId = 0
                };
            }
            return(rec);
        }
コード例 #3
0
        /*
         * /// <summary>
         * /// 分页获取数据列表
         * /// </summary>
         * public DataSet GetList(int PageSize,int PageIndex,string strWhere)
         * {
         *      SqlParameter[] parameters = {
         *                      new SqlParameter("@tblName", SqlDbType.VarChar, 255),
         *                      new SqlParameter("@fldName", SqlDbType.VarChar, 255),
         *                      new SqlParameter("@PageSize", SqlDbType.Int),
         *                      new SqlParameter("@PageIndex", SqlDbType.Int),
         *                      new SqlParameter("@IsReCount", SqlDbType.Bit),
         *                      new SqlParameter("@OrderType", SqlDbType.Bit),
         *                      new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
         *                      };
         *      parameters[0].Value = "RealTimeUploadRecord";
         *      parameters[1].Value = "Id";
         *      parameters[2].Value = PageSize;
         *      parameters[3].Value = PageIndex;
         *      parameters[4].Value = 0;
         *      parameters[5].Value = 0;
         *      parameters[6].Value = strWhere;
         *      return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
         * }*/

        #endregion  Method

        #region Extention Method
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RealTimeUploadRecord GetModel(PurchaserType purchaser)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,LastUpdateTime,IsLock,LockPerson,Remark,CreateTime from RealTimeUploadRecord  where  Purchaser = '" + purchaser.ToString() + "' order by CreateTime desc ");
            RealTimeUploadRecord model = new RealTimeUploadRecord();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = new Guid(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                model.LastUpdateTime = ds.Tables[0].Rows[0]["LastUpdateTime"].ToString();
                if (ds.Tables[0].Rows[0]["IsLock"].ToString() != "")
                {
                    model.IsLock = int.Parse(ds.Tables[0].Rows[0]["IsLock"].ToString());
                }
                model.LockPerson = ds.Tables[0].Rows[0]["LockPerson"].ToString();
                model.Remark     = ds.Tables[0].Rows[0]["Remark"].ToString();
                if (ds.Tables[0].Rows[0]["CreateTime"].ToString() != "")
                {
                    model.CreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["CreateTime"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }