Beispiel #1
0
        /// <summary>
        /// 获取本次需要导入的最大时间
        /// </summary>
        /// <returns>返回本次需要导入的时间,如果没有获得时间则值为空</returns>
        private DateTime?GetNeed2ImportTime()
        {
            string sql = "select max(CONVERT(DateTime,PrintDate+' '+PrintTime,120)) from tbl_PrintRecord;";
            object obj = null;

            try
            {
                obj = RemoteDbServer.QueryObj(sql);
            }
            catch (Exception)
            {
                obj = string.Empty;
            }
            DateTime dt = DateTime.Now;

            return(DateTime.TryParse(obj.ToString(), out dt) ? dt : (DateTime?)(null));
        }
Beispiel #2
0
        /// <summary>
        /// 获取需要更新的生产单数量
        /// </summary>
        /// <param name="dtStart">更新的起始时间</param>
        /// <param name="dtEnd">更新的终止时间</param>
        /// <returns>需要更新生产单的条数</returns>
        private int GetMpoCount2Import(DateTime?dtStart, DateTime?dtEnd)
        {
            string sql = "select count(1) from tbl_PrintRecord;";
            Dictionary <string, object> pms = new Dictionary <string, object>();

            if (dtStart.HasValue && !dtEnd.HasValue)
            {
                sql = "select count(1) from tbl_PrintRecord where CONVERT(DateTime,PrintDate+' '+PrintTime,120)>@dtStart;";
                pms.Add("@dtStart", (DateTime)dtStart);
            }
            else if (dtStart.HasValue && dtEnd.HasValue)
            {
                sql = "select count(1) from tbl_PrintRecord where CONVERT(DateTime,PrintDate+' '+PrintTime,120)>@dtStart and CONVERT(DateTime,PrintDate+' '+PrintTime,120)<@dtEnd;";
                pms.Add("@dtStart", (DateTime)dtStart);
                pms.Add("@dtEnd", (DateTime)dtEnd);
            }
            object obj    = RemoteDbServer.QueryObj(sql, pms);
            int    intTmp = 0;

            return(int.TryParse((obj ?? "0").ToString(), out intTmp) ? intTmp : 0);
        }