//static string _nameSpaceClass = "HotelVp.JobConsole.Biz.AutoMsgCancelOrdBP  Method: ";
        public static void AutoMsgCanceling(string ActionType)
        {
            DateTime dtBegin = new DateTime();
            dtBegin = System.DateTime.Now;

            if (!"1".Equals(ActionType) && !ChkAction())
            {
                Console.WriteLine("未到发送时间。JOB自动关闭。");
                return;
            }

            AutoMsgCancelOrdEntity _automsgcancelordEntity = new AutoMsgCancelOrdEntity();
            CommonEntity _commonEntity = new CommonEntity();
            _automsgcancelordEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _automsgcancelordEntity.LogMessages.Userid = "JOB System";
            _automsgcancelordEntity.LogMessages.Username = "******";
            _automsgcancelordEntity.AutoMsgCancelOrdDBEntity = new List<AutoMsgCancelOrdDBEntity>();
            AutoMsgCancelOrdDBEntity appcontentDBEntity = new AutoMsgCancelOrdDBEntity();
            _automsgcancelordEntity.AutoMsgCancelOrdDBEntity.Add(appcontentDBEntity);

            appcontentDBEntity.TypeID = ActionType;
            Console.WriteLine("订单提示短信JOB自动运行开始");
            int iCount = AutoSelect(_automsgcancelordEntity);
            Console.WriteLine("订单提示短信JOB自动运行 执行记录数:" + iCount.ToString());
            DateTime dtEnd = new DateTime();
            dtEnd = System.DateTime.Now;

            Console.WriteLine(dtEnd - dtBegin);
        }
        public static DataSet AutoListSelect(AutoMsgCancelOrdEntity automsgcancelordEntity)
        {
            AutoMsgCancelOrdDBEntity dbParm = (automsgcancelordEntity.AutoMsgCancelOrdDBEntity.Count > 0) ? automsgcancelordEntity.AutoMsgCancelOrdDBEntity[0] : new AutoMsgCancelOrdDBEntity();
            DataSet dsResult = new DataSet();
            OracleParameter[] parm ={
                                    new OracleParameter("STARTDTIME",OracleType.VarChar),
                                    new OracleParameter("ENDDTIME",OracleType.VarChar)
                                };
            string strStartDT = "";
            string strEndDT = "";

            if ("1".Equals(dbParm.TypeID))
            {
                strStartDT = DateTime.Now.ToShortDateString() + " 04:00:00";
                strEndDT = DateTime.Now.ToShortDateString() + " 16:00:00";
            }
            else
            {
                strStartDT = SetParamDtime(-79);
                strEndDT = SetParamDtime(-69);
            }

            parm[0].Value = strStartDT;
            parm[1].Value = strEndDT;

            dsResult = DbManager.Query("AutoMsgCancelOrd", "AutoListSelect", true, parm);
            return dsResult;
        }
        private static string ApplySendMsgService(DataRow drRow)
        {
            AutoMsgCancelOrdEntity _automsgcancelordEntity = new AutoMsgCancelOrdEntity();
            _automsgcancelordEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _automsgcancelordEntity.LogMessages.Userid = "JOB System";
            _automsgcancelordEntity.LogMessages.Username = "******";
            _automsgcancelordEntity.AutoMsgCancelOrdDBEntity = new List<AutoMsgCancelOrdDBEntity>();
            AutoMsgCancelOrdDBEntity appcontentDBEntity = new AutoMsgCancelOrdDBEntity();

            appcontentDBEntity.OrderNo = drRow["ORDERNO"].ToString().Trim();
            appcontentDBEntity.CreateUser = drRow["USERID"].ToString().Trim();
            appcontentDBEntity.CreateDTime = drRow["CREATETIME"].ToString().Trim();
            appcontentDBEntity.HotelNM = drRow["HOTELNM"].ToString().Trim();
            appcontentDBEntity.UserNM = drRow["USERNM"].ToString().Trim();
            _automsgcancelordEntity.AutoMsgCancelOrdDBEntity.Add(appcontentDBEntity);
            _automsgcancelordEntity = AutoMsgCancelOrdSA.ApplySendMsgService(_automsgcancelordEntity);

            return _automsgcancelordEntity.ErrorMSG;
        }
        public static AutoMsgCancelOrdEntity ApplySendMsgService(AutoMsgCancelOrdEntity automsgcancelordEntity)
        {
            AutoMsgCancelOrdDBEntity dbParm = (automsgcancelordEntity.AutoMsgCancelOrdDBEntity.Count > 0) ? automsgcancelordEntity.AutoMsgCancelOrdDBEntity[0] : new AutoMsgCancelOrdDBEntity();
            string MsgContent = string.Empty;

            if (DateTime.Now >= DateTime.Parse(DateTime.Now.ToShortDateString() + " 18:00:00"))
            {
                MsgContent = String.Format(ConfigurationManager.AppSettings["MsgContent18after"].ToString(), dbParm.UserNM, dbParm.HotelNM);
            }
            else
            {
                MsgContent = String.Format(ConfigurationManager.AppSettings["MsgContent18befor"].ToString(), dbParm.UserNM, dbParm.HotelNM);
            }

            string DataString = "";
            DataString = DataString + "{\"method\":\"save\",\"data\":{\"syscode\":\"" + "CMS" + "\",\"reqid\":\"" + dbParm.CreateUser +"\",\"bizcode\":\"" + "CMS-JOB-短信提示取消单" +"\",";
            DataString = DataString + "\"cnfnum\":\"" + dbParm.OrderNo + "\",\"mobiles\":\"" + dbParm.CreateUser + "\",\"msg\":\"" + MsgContent + "\",";
            DataString = DataString + "\"sign\":\"" + PostSignKey("CMS" + dbParm.CreateUser) + "\"},\"version\":\"v1.0\"}";

            string HotelFullRoomUrl = JsonRequestURLBuilder.applySendMsgV2();
            CallWebPage callWebPage = new CallWebPage();
            string strHotelFullRoom = callWebPage.CallWebByURL(HotelFullRoomUrl, DataString);
            JObject oHotelFullRoom = JObject.Parse(strHotelFullRoom);
            if ("success".Equals(JsonRequestURLBuilder.GetJsonStringValue(oHotelFullRoom, "message").Trim('"')))
            {
                automsgcancelordEntity.Result = 1;
                automsgcancelordEntity.ErrorMSG = "保存成功!";
            }
            else
            {
                automsgcancelordEntity.Result = 2;
                automsgcancelordEntity.ErrorMSG = "保存失败!" + JsonRequestURLBuilder.GetJsonStringValue(oHotelFullRoom, "message").Trim('"');
            }

            return automsgcancelordEntity;
        }
        private static int AutoSelect(AutoMsgCancelOrdEntity autogotelplanEntity)
        {
            string strOrderType = ConfigurationManager.AppSettings["OrderType"].ToString();
            DataSet dsResult = new DataSet();
            dsResult = AutoMsgCancelOrdDA.AutoListSelect(autogotelplanEntity);
            string Result = string.Empty;
            foreach (DataRow drRow in dsResult.Tables[0].Rows)
            {
                if (!ChkOrderType(drRow["ORDERNO"].ToString().Trim(), strOrderType))
                {
                    continue;
                }

                Result = ApplySendMsgService(drRow);
                CommonEntity _commonEntity = new CommonEntity();
                _commonEntity.LogMessages = autogotelplanEntity.LogMessages;
                _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
                CommonDBEntity commonDBEntity = new CommonDBEntity();

                commonDBEntity.Event_Type = "订单提示短信JOB";
                commonDBEntity.Event_ID = drRow["USERID"].ToString().Trim();
                string conTent = "订单提示短信JOB - FOG订单ID:{0} 创建人:{1} 创建时间:{2} ";
                conTent = string.Format(conTent, drRow["ORDERNO"].ToString().Trim(), drRow["USERID"].ToString().Trim(), drRow["CREATETIME"].ToString().Trim());
                commonDBEntity.Event_Content = conTent;
                commonDBEntity.Event_Result = Result;
                _commonEntity.CommonDBEntity.Add(commonDBEntity);
                CommonBP.InsertEventHistory(_commonEntity);
            }
            return dsResult.Tables[0].Rows.Count;
        }