コード例 #1
0
        //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);
        }
コード例 #2
0
        //static string _nameSpaceClass = "HotelVp.JobConsole.Biz.AutoIssueCreating  Method: ";
        public static void AutoIssueCreating(string ActionType)
        {
            DateTime dtBegin = new DateTime();
            dtBegin = System.DateTime.Now;
            AutoIssueCreateEntity _autoissuecreateEntity = new AutoIssueCreateEntity();
            CommonEntity _commonEntity = new CommonEntity();
            _autoissuecreateEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _autoissuecreateEntity.LogMessages.Userid = "JOB System";
            _autoissuecreateEntity.LogMessages.Username = "******";
            _autoissuecreateEntity.AutoMsgCancelOrdDBEntity = new List<AutoMsgCancelOrdDBEntity>();
            AutoMsgCancelOrdDBEntity appcontentDBEntity = new AutoMsgCancelOrdDBEntity();
            _autoissuecreateEntity.AutoMsgCancelOrdDBEntity.Add(appcontentDBEntity);
            Console.WriteLine("问题订单自动创建Issue单JOB自动运行开始");
            //所有CC取消状态为:满房/变价的自动判定为“酒店问题”Issue单
            //所有LMBAR&LMBAR2的订单处理时长超过30分钟自动判定为“订单问题”Issue单

            int iCount = 0;
            if ("1".Equals(ActionType))
            {
                AutoTodaySelect();
            }
            else if ("2".Equals(ActionType))
            {
                iCount = AutoSelectHotel(_autoissuecreateEntity);
            }
            else
            {
                iCount = AutoSelect(_autoissuecreateEntity);
            }
            Console.WriteLine("问题订单自动创建Issue单JOB自动运行 执行记录数:" + iCount.ToString());
            DateTime dtEnd = new DateTime();
            dtEnd = System.DateTime.Now;

            Console.WriteLine(dtEnd - dtBegin);
        }
コード例 #3
0
        public static void AutoHotelPlaning()
        {
            DateTime dtBegin = new DateTime();
            dtBegin = System.DateTime.Now;

            AutoHotelPlanEntity _autohotelplanEntity = new AutoHotelPlanEntity();
            CommonEntity _commonEntity = new CommonEntity();
            _autohotelplanEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _autohotelplanEntity.LogMessages.Userid = "JOB System";
            _autohotelplanEntity.LogMessages.Username = "******";
            _autohotelplanEntity.AutoHotelPlanDBEntity = new List<AutoHotelPlanDBEntity>();
            AutoHotelPlanDBEntity appcontentDBEntity = new AutoHotelPlanDBEntity();
            _autohotelplanEntity.AutoHotelPlanDBEntity.Add(appcontentDBEntity);
            Console.WriteLine("酒店销售计划JOB自动运行开始");
            int iCount = AutoSelect(_autohotelplanEntity);
            Console.WriteLine("酒店销售计划JOB自动运行 执行记录数:" + iCount.ToString());
            //Console.WriteLine("发送邮件开始");
            //bool bResult = SendMailExpress(dsResult);
            //string strResult = "失败";
            //if (bResult)
            //{
            //    strResult = "成功";
            //}
            //else
            //{
            //    Thread.Sleep(5000);
            //}

            //Console.WriteLine("发送邮件结束 结果:" + strResult);

            DateTime dtEnd = new DateTime();
            dtEnd = System.DateTime.Now;

            Console.WriteLine(dtEnd - dtBegin);
        }
コード例 #4
0
        public static int InsertEventHistory(CommonEntity commonEntity)
        {
            commonEntity.LogMessages.MsgType = MessageType.INFO;
            commonEntity.LogMessages.Content = _nameSpaceClass + "InsertEventHistory";
            LoggerHelper.LogWriter(commonEntity.LogMessages);

            try
            {
                return CommonDA.InsertEventHistory(commonEntity);
            }
            catch (Exception ex)
            {
                commonEntity.LogMessages.MsgType = MessageType.ERROR;
                commonEntity.LogMessages.Content = _nameSpaceClass + "InsertEventHistory  Error: " + ex.Message;
                LoggerHelper.LogWriter(commonEntity.LogMessages);
                throw ex;
            }
        }
コード例 #5
0
 public static int InsertEventHistory(CommonEntity CommonEntity)
 {
     if (CommonEntity.CommonDBEntity.Count == 0)
     {
         return 0;
     }
     DataCommand cmd = DataCommandManager.GetDataCommand("InsertEventHistory");
     foreach (CommonDBEntity dbParm in CommonEntity.CommonDBEntity)
     {
         cmd.SetParameterValue("@USERID", (CommonEntity.LogMessages != null) ? CommonEntity.LogMessages.Userid : "");
         cmd.SetParameterValue("@USERNAME", (CommonEntity.LogMessages != null) ? CommonEntity.LogMessages.Username : "");
         cmd.SetParameterValue("@IPADDRESS", (CommonEntity.LogMessages != null) ? CommonEntity.LogMessages.IpAddress : "");
         cmd.SetParameterValue("@EVENTTYPE", dbParm.Event_Type);
         cmd.SetParameterValue("@EVENTID", dbParm.Event_ID);
         cmd.SetParameterValue("@EVENTCONTENT", dbParm.Event_Content);
         cmd.SetParameterValue("@EVENTRESULT", dbParm.Event_Result);
         cmd.ExecuteNonQuery();
     }
     return 1;
 }
コード例 #6
0
        //static string _nameSpaceClass = "HotelVp.JobConsole.Biz.AutoOrderSynchronizing  Method: ";
        public static void AutoReciveFaxing()
        {
            DateTime dtBegin = new DateTime();
            dtBegin = System.DateTime.Now;

            AutoReciveFaxEntity _hotelcomparisonEntity = new AutoReciveFaxEntity();
            CommonEntity _commonEntity = new CommonEntity();
            _hotelcomparisonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _hotelcomparisonEntity.LogMessages.Userid = "JOB System";
            _hotelcomparisonEntity.LogMessages.Username = "******";

            Console.WriteLine("比价JOB自动运行开始");

            int iCount = AutoFaxSA.QueryFaxList();

            Console.WriteLine("比价JOB自动运行结束 记录数:" + iCount.ToString());
            DateTime dtEnd = new DateTime();
            dtEnd = System.DateTime.Now;

            Console.WriteLine(dtEnd - dtBegin);
        }
コード例 #7
0
        public static CommonEntity GetEventHistoryList(CommonEntity commonEntity)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("GetEventHistoryList");

            CommonDBEntity dbParm = (commonEntity.CommonDBEntity.Count > 0) ? commonEntity.CommonDBEntity[0] : new CommonDBEntity();
            cmd.SetParameterValue("@USERID", dbParm.UserID);
            cmd.SetParameterValue("@USERNAME", dbParm.UserName);
            cmd.SetParameterValue("@IPADDRESS", dbParm.IpAddress);
            cmd.SetParameterValue("@EVENTTYPE", dbParm.Event_Type);
            cmd.SetParameterValue("@EVENTID", dbParm.Event_ID);
            cmd.SetParameterValue("@EVENTCONTENT", dbParm.Event_Content);
            cmd.SetParameterValue("@EVENTRESULT", dbParm.Event_Result);
            cmd.SetParameterValue("@StartDTime", dbParm.StartDTime);
            cmd.SetParameterValue("@EndDTime", dbParm.EndDTime);

            cmd.SetParameterValue("@PageCurrent", commonEntity.PageCurrent);
            cmd.SetParameterValue("@PageSize", commonEntity.PageSize);
            cmd.SetParameterValue("@SortField", commonEntity.SortField);
            cmd.SetParameterValue("@SortType", commonEntity.SortType);
            commonEntity.QueryResult = cmd.ExecuteDataSet();
            commonEntity.TotalCount = (int)cmd.GetParameterValue("@TotalCount");
            return commonEntity;
        }
コード例 #8
0
        //static string _nameSpaceClass = "HotelVp.JobConsole.Biz.AutoOrderSynchronizing  Method: ";
        public static void AutoMappingBeding()
        {
            DateTime dtBegin = new DateTime();
            dtBegin = System.DateTime.Now;

            AutoMappingBedEntity _hotelcomparisonEntity = new AutoMappingBedEntity();
            CommonEntity _commonEntity = new CommonEntity();
            _hotelcomparisonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _hotelcomparisonEntity.LogMessages.Userid = "JOB System";
            _hotelcomparisonEntity.LogMessages.Username = "******";
            _hotelcomparisonEntity.AutoHotelComparisonDBEntity = new List<AutoHotelComparisonDBEntity>();
            AutoHotelComparisonDBEntity hotelcomparisondbentity = new AutoHotelComparisonDBEntity();
            _hotelcomparisonEntity.AutoHotelComparisonDBEntity.Add(hotelcomparisondbentity);

            Console.WriteLine("ELMappingRoomBedJOB自动运行开始");

            int iCount = AutoMappingBeding(_hotelcomparisonEntity);

            Console.WriteLine("ELMappingRoomBedJOB自动运行 执行记录数:" + iCount.ToString());
            DateTime dtEnd = new DateTime();
            dtEnd = System.DateTime.Now;

            Console.WriteLine(dtEnd - dtBegin);
        }
コード例 #9
0
        public static void PinyingSetting()
        {
            DateTime dtBegin = new DateTime();
            dtBegin = System.DateTime.Now;
            DataSet dsHotel = PinyingDA.GetHotelPinyingList();

            if (dsHotel.Tables.Count == 0 || dsHotel.Tables[0].Rows.Count == 0)
            {
                return;
            }

            CommonEntity _commonEntity = new CommonEntity();
            _commonEntity.LogMessages = new Common.Logger.LogMessage();

            IPHostEntry hostInfo = Dns.GetHostByName(Dns.GetHostName());
            IPAddress[] address = hostInfo.AddressList;
            string m_IP = address[0].ToString();

            _commonEntity.LogMessages.IpAddress = m_IP;
            _commonEntity.LogMessages.Computername = Dns.GetHostName();
            _commonEntity.LogMessages.Userid = "JOB System";
            _commonEntity.LogMessages.Username = "******";
            _commonEntity.CommonDBEntity = new List<CommonDBEntity>();

            string strResult = "";
            string strContent = "";
            string strTemp = "酒店目的地信息管理--酒店ID:{0} 全拼:{1} 短拼:{2}";
            string strSQL = XmlSqlAnalyze.GotSqlTextFromXml("Pinying", "t_lm_b_pinying_hotel_save");
            Hashtable htList = new Hashtable();
            int iCount = 0;
            int MaxLength = (String.IsNullOrEmpty(ConfigurationManager.AppSettings["MaxLength"].ToString())) ? 1000 : int.Parse(ConfigurationManager.AppSettings["MaxLength"].ToString());
            List<CommandInfo> cmdList = new List<CommandInfo>();

            ChineseCode chineseCode = new ChineseCode();
            for (int i = 0; i <= dsHotel.Tables[0].Rows.Count - 1; i++)
            {
                if (String.IsNullOrEmpty(dsHotel.Tables[0].Rows[i]["HOTELID"].ToString()))
                {
                    continue;
                }

                //dsHotel.Tables[0].Rows[i]["LPINYIN"] = HotelVp.Common.Utilities.PinyinHelper.GetPinyin(dsHotel.Tables[0].Rows[i]["PROPNAME"].ToString().Trim());
                //dsHotel.Tables[0].Rows[i]["SPINYIN"] = HotelVp.Common.Utilities.PinyinHelper.GetShortPinyin(dsHotel.Tables[0].Rows[i]["PROPNAME"].ToString().Trim());

                try
                {
                    dsHotel.Tables[0].Rows[i]["LPINYIN"] = String.IsNullOrEmpty(dsHotel.Tables[0].Rows[i]["PROPNAME"].ToString().Trim()) ? "" : chineseCode.GetSpell(dsHotel.Tables[0].Rows[i]["PROPNAME"].ToString().Trim());
                    dsHotel.Tables[0].Rows[i]["SPINYIN"] = String.IsNullOrEmpty(dsHotel.Tables[0].Rows[i]["PROPNAME"].ToString().Trim()) ? "" : chineseCode.IndexCode(dsHotel.Tables[0].Rows[i]["PROPNAME"].ToString().Trim()).ToLower();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                CommandInfo cminfo = new CommandInfo();
                cminfo.CommandText = strSQL;
                OracleParameter[] lmParm ={
                                    new OracleParameter("HOTELID",OracleType.VarChar),
                                    new OracleParameter("LPINYIN",OracleType.VarChar),
                                    new OracleParameter("SPINYIN",OracleType.VarChar)
                                };

                lmParm[0].Value = dsHotel.Tables[0].Rows[i]["HOTELID"].ToString();
                lmParm[1].Value = dsHotel.Tables[0].Rows[i]["LPINYIN"].ToString();
                lmParm[2].Value = dsHotel.Tables[0].Rows[i]["SPINYIN"].ToString();
                cminfo.Parameters = lmParm;
                cmdList.Add(cminfo);
                iCount = iCount + 1;
                if (MaxLength == iCount)
                {
                    try
                    {
                        PinyingDA.SavePinyingCommonList(cmdList);
                        strResult = "成功";
                    }
                    catch
                    {
                        strResult = "失败";
                    }

                    foreach (CommandInfo tempinfo in cmdList)
                    {
                        OracleParameter[] tempParm = (OracleParameter[])tempinfo.Parameters;
                        strContent = string.Format(strTemp, tempParm[0].Value.ToString(), tempParm[1].Value.ToString(), tempParm[2].Value.ToString());

                        CommonDBEntity commonDBEntity = new CommonDBEntity();
                        commonDBEntity.Event_Type = "JOB-酒店拼音设置";
                        commonDBEntity.Event_Content = strContent;
                        commonDBEntity.Event_Result = strResult;
                        commonDBEntity.Event_ID = tempParm[0].Value.ToString();
                        commonDBEntity.UserID = "JOB System";
                        commonDBEntity.UserID = "JOB System";

                        _commonEntity.LogMessages.Event_id = tempParm[0].Value.ToString();
                        _commonEntity.CommonDBEntity.Add(commonDBEntity);
                        CommonBP.InsertEventHistory(_commonEntity);
                        _commonEntity.CommonDBEntity.Clear();
                        Console.WriteLine(strContent + "设置结果:" + strResult);
                    }

                    iCount = 0;
                    cmdList.Clear();
                }
            }

            if (iCount > 0)
            {
                try
                {
                    PinyingDA.SavePinyingCommonList(cmdList);
                    strResult = "成功";
                }
                catch
                {
                    strResult = "失败";
                }

                foreach (CommandInfo tempinfo in cmdList)
                {
                    OracleParameter[] tempParm = (OracleParameter[])tempinfo.Parameters;
                    strContent = string.Format(strTemp, tempParm[0].Value.ToString(), tempParm[1].Value.ToString(), tempParm[2].Value.ToString());

                    CommonDBEntity commDBEntity = new CommonDBEntity();
                    commDBEntity.Event_Type = "JOB-酒店拼音设置";
                    commDBEntity.Event_Content = strContent;
                    commDBEntity.Event_Result = strResult;
                    commDBEntity.Event_ID = tempParm[0].Value.ToString();

                    _commonEntity.LogMessages.Event_id = tempParm[0].Value.ToString();
                    _commonEntity.CommonDBEntity.Add(commDBEntity);
                    CommonBP.InsertEventHistory(_commonEntity);
                    _commonEntity.CommonDBEntity.Clear();
                    Console.WriteLine(strContent + "设置结果:" + strResult);
                }
            }

            DateTime dtEnd = new DateTime();
            dtEnd = System.DateTime.Now;

            Console.WriteLine(dtEnd - dtBegin);
        }
コード例 #10
0
        private static int AutoSelect(AutoHotelPlanEntity autogotelplanEntity)
        {
            int iMaxLenth = String.IsNullOrEmpty(ConfigurationManager.AppSettings["MaxLength"]) ? 200 : int.Parse(ConfigurationManager.AppSettings["MaxLength"].ToString());
            DataSet dsResult = new DataSet();
            dsResult = AutoHotelPlanDA.AutoListSelect(autogotelplanEntity);
            int iCount = 0;
            string PlanID=string.Empty;
            string Status=string.Empty;
            string Action=string.Empty;
            string Result=string.Empty;
            string Username = string.Empty;
            //string strToDay = DateTime.Now.ToShortDateString();
            //int strToWeek = (int)DateTime.Now.DayOfWeek + 1;
            //string strDayTemp = string.Empty;
            string strWeekTemp = string.Empty;
            string strTypeNm = string.Empty;
            string strTypeTime = string.Empty;
            string ChkResult = string.Empty;

            ArrayList alHotelList = new ArrayList();
            Hashtable htErrList = new Hashtable();
            Hashtable htErr = new Hashtable();

            foreach (DataRow drRow in dsResult.Tables[0].Rows)
            {
                if (!"0".Equals(drRow["Type"].ToString().Trim()))
                {
                    ChkResult = CheckApplySalesRoomService(drRow, drRow["Type"].ToString().Trim());
                    if (!String.IsNullOrEmpty(ChkResult))
                    {
                        htErrList.Add(drRow["HPID"].ToString().Trim(), ChkResult);
                    }
                    else
                    {
                        alHotelList.Add(drRow);
                    }
                }
                else
                {
                    alHotelList.Add(drRow);
                }

                iCount = iCount + 1;
                if (iCount == iMaxLenth)
                {
                    htErr = ApplySalesRoomServiceList(alHotelList);
                    foreach (System.Collections.DictionaryEntry item in htErr)
                    {
                        if (!htErrList.ContainsKey(item.Key.ToString()))
                        {
                            htErrList.Add(item.Key.ToString(), item.Value.ToString());
                        }
                    }
                    iCount = 0;
                }
            }

            if (iCount > 0)
            {
                htErr = ApplySalesRoomServiceList(alHotelList);
                foreach (System.Collections.DictionaryEntry item in htErr)
                {
                    if (!htErrList.ContainsKey(item.Key.ToString()))
                    {
                        htErrList.Add(item.Key.ToString(), item.Value.ToString());
                    }
                }
            }

            foreach (DataRow drRow in dsResult.Tables[0].Rows)
            {
                if ("0".Equals(drRow["Type"].ToString().Trim()))
                {
                    strTypeNm = "立即保存";
                    strTypeTime = drRow["Plan_DTime"].ToString().Trim();
                    PlanID = drRow["HPID"].ToString().Trim();
                    Status = "2";
                    Action = "1";
                    //Result = ApplySalesRoomService(drRow, drRow["Type"].ToString().Trim());
                    Result = htErrList[drRow["HPID"].ToString().Trim()].ToString();
                    Username = drRow["Create_User"].ToString().Trim();
                    AutoHotelPlanDA.UpdateSalesPlanEventStatus(PlanID, Status, Action, Result, Username);
                    AutoHotelPlanDA.UpdateSalesPlanEventJobStatus(drRow["JID"].ToString().Trim(), Action, Result, Username);
                    iCount = iCount + 1;
                }
                else if ("1".Equals(drRow["Type"].ToString().Trim()))
                {
                    strTypeNm = "定时保存";
                    strTypeTime = drRow["Plan_DTime"].ToString().Trim();
                    PlanID = drRow["HPID"].ToString().Trim();
                    Status = "2";
                    Action = "1";
                    //Result = ApplySalesRoomService(drRow, drRow["Type"].ToString().Trim());
                    Result = htErrList[drRow["HPID"].ToString().Trim()].ToString();
                    Username = drRow["Create_User"].ToString().Trim();
                    AutoHotelPlanDA.UpdateSalesPlanEventStatus(PlanID, Status, Action, Result, Username);
                    AutoHotelPlanDA.UpdateSalesPlanEventJobStatus(drRow["JID"].ToString().Trim(), Action, Result, Username);
                    iCount = iCount + 1;
                }
                else if ("2".Equals(drRow["Type"].ToString().Trim()))
                {
                    strTypeNm = "每日自动更新";
                    strTypeTime = drRow["PlanTime"].ToString().Trim();
                    //strDayTemp = drRow["EndDtime"].ToString().Trim();
                    strWeekTemp = drRow["Week_List"].ToString().Trim();

                    Status = (DateTime.Parse(drRow["JPDTime"].ToString().Trim()) == DateTime.Parse(drRow["PlanPlanEnd"].ToString().Trim() + " " + drRow["PlanTime"].ToString().Trim())) ? "2" : "1";
                    PlanID = drRow["HPID"].ToString().Trim();

                    //Console.WriteLine("Action:" + drRow["Action"].ToString().Trim());
                    //Console.WriteLine("HPID:" + drRow["HPID"].ToString().Trim());
                    //Console.WriteLine(htErrList[drRow["HPID"].ToString().Trim()].ToString());

                    Action = ChkNumerVal(drRow["Action"].ToString().Trim()).ToString();
                    //Result = ApplySalesRoomService(drRow, drRow["Type"].ToString().Trim());
                    Result = htErrList[drRow["HPID"].ToString().Trim()].ToString();
                    Username = drRow["Create_User"].ToString().Trim();
                    AutoHotelPlanDA.UpdateSalesPlanEventStatus(PlanID, Status, Action, Result, Username);
                    AutoHotelPlanDA.UpdateSalesPlanEventJobStatus(drRow["JID"].ToString().Trim(), "1", Result, Username);
                    iCount = iCount + 1;
                }

                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["HPID"].ToString().Trim();
                string conTent = "销售计划 运行一次 - 计划ID:{0} 更新方式:{1} 定时执行时间:{2} 定时开始日期:{3} 定时结束日期:{4} 星期详情:{5} 修改时间:{6} 修改人:{7}";
                conTent = string.Format(conTent, drRow["HPID"].ToString().Trim(), strTypeNm, strTypeTime, drRow["StartDtime"].ToString().Trim(), drRow["EndDtime"].ToString().Trim(), strWeekTemp, drRow["Update_Time"].ToString().Trim(), drRow["Update_User"].ToString().Trim());
                commonDBEntity.Event_Content = conTent;
                commonDBEntity.Event_Result = Result;
                _commonEntity.CommonDBEntity.Add(commonDBEntity);
                CommonBP.InsertEventHistory(_commonEntity);
            }
            return dsResult.Tables[0].Rows.Count;
        }
コード例 #11
0
        private static int AutoMappingBeding(AutoMappingBedEntity hotelcomparisonEntity)
        {
            CommonEntity _commonEntity = new CommonEntity();
            _commonEntity.LogMessages = new Common.Logger.LogMessage();

            IPHostEntry hostInfo = Dns.GetHostByName(Dns.GetHostName());
            IPAddress[] address = hostInfo.AddressList;
            string m_IP = address[0].ToString();

            _commonEntity.LogMessages.IpAddress = m_IP;
            _commonEntity.LogMessages.Computername = Dns.GetHostName();
            _commonEntity.LogMessages.Userid = "JOB System";
            _commonEntity.LogMessages.Username = "******";
            _commonEntity.CommonDBEntity = new List<CommonDBEntity>();

            DataSet dsResult = AutoMappingBedDA.AutoHotelRoomMappingList(hotelcomparisonEntity);

            DataTable dtMapping = new DataTable();
            dtMapping.Columns.Add("SOURCE");
            dtMapping.Columns.Add("HOTELID");
            dtMapping.Columns.Add("ROOMCD");
            dtMapping.Columns.Add("BED");
            string ELBed = string.Empty;
            string strSQL = XmlSqlAnalyze.GotSqlTextFromXml("AutoMappingBed", "SaveHotelRoomBed");
            int iCount = 0;
            int MaxLength = (String.IsNullOrEmpty(ConfigurationManager.AppSettings["MaxLength"].ToString())) ? 1000 : int.Parse(ConfigurationManager.AppSettings["MaxLength"].ToString());
            List<CommandInfo> cmdList = new List<CommandInfo>();

            DataRow[] drTemp;
            for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++)
            {
                drTemp = dtMapping.Select("SOURCE='" + dsResult.Tables[0].Rows[i]["MPType"].ToString().Trim() + "' and HOTELID='" + dsResult.Tables[0].Rows[i]["Mapping_Hotel"].ToString().Trim() + "'" + " and ROOMCD = '" + dsResult.Tables[0].Rows[i]["Mapping_Room"].ToString().Trim() + "'");
                if (drTemp.Count() <= 0)
                {
                    Console.WriteLine(dsResult.Tables[0].Rows[i]["Mapping_Hotel"].ToString().Trim() + " - " + dsResult.Tables[0].Rows[i]["Mapping_Room"].ToString().Trim() + " 艺龙接口调用开始");
                    GetMappingPrice(dsResult.Tables[0].Rows[i]["MPType"].ToString().Trim(), dsResult.Tables[0].Rows[i]["Mapping_Hotel"].ToString().Trim(), dsResult.Tables[0].Rows[i]["Mapping_Room"].ToString().Trim(), ref dtMapping);
                    Console.WriteLine(dsResult.Tables[0].Rows[i]["Mapping_Hotel"].ToString().Trim() + " - " + dsResult.Tables[0].Rows[i]["Mapping_Room"].ToString().Trim() + " 艺龙接口调用结束");
                    Console.WriteLine(dtMapping.Rows.Count);

                    drTemp = dtMapping.Select("SOURCE='" + dsResult.Tables[0].Rows[i]["MPType"].ToString().Trim() + "' and HOTELID='" + dsResult.Tables[0].Rows[i]["Mapping_Hotel"].ToString().Trim() + "'" + " and ROOMCD = '" + dsResult.Tables[0].Rows[i]["Mapping_Room"].ToString().Trim() + "'");
                    if (drTemp.Count() <= 0)
                    {
                        Console.WriteLine("无");
                        continue;
                    }
                    else
                    {
                        ELBed = drTemp[0]["BED"].ToString();
                    }
                }
                else
                {
                    Console.WriteLine(dtMapping.Rows.Count);
                    ELBed = drTemp[0]["BED"].ToString();
                }

                if (String.IsNullOrEmpty(ELBed))
                {
                    continue;
                }

                dsResult.Tables[0].Rows[i]["ROOMBED"] = ELBed;

                CommandInfo cminfo = new CommandInfo();
                cminfo.CommandText = strSQL;
                OracleParameter[] lmParm ={
                                    new OracleParameter("HOTELID",OracleType.VarChar),
                                   new OracleParameter("ROOMCODE",OracleType.VarChar),
                                   new OracleParameter("ROOMAREA",OracleType.VarChar),
                                   new OracleParameter("UPDATEUSER",OracleType.VarChar)
                                };
                lmParm[0].Value = dsResult.Tables[0].Rows[i]["Hotel_ID"].ToString().Trim();
                lmParm[1].Value = dsResult.Tables[0].Rows[i]["Room_Code"].ToString().Trim();
                lmParm[2].Value = dsResult.Tables[0].Rows[i]["ROOMBED"].ToString().Trim();
                lmParm[3].Value = "CMS JOB";

                cminfo.Parameters = lmParm;
                cmdList.Add(cminfo);
                iCount = iCount + 1;

                if (MaxLength == iCount)
                {
                    try
                    {
                        AutoMappingBedDA.SaveHotelRoomBedList(cmdList);
                        Console.Write("成功");
                        iCount = 0;
                        cmdList.Clear();
                    }
                    catch
                    {
                        Console.Write("失败");
                    }
                }

                //AutoMappingBedDA.SaveHotelRoomBed(dsResult.Tables[0].Rows[i]);
            }

            if (iCount > 0)
            {
                try
                {
                    AutoMappingBedDA.SaveHotelRoomBedList(cmdList);
                    Console.Write("成功");
                    iCount = 0;
                    cmdList.Clear();
                }
                catch
                {
                    Console.Write("失败");
                }
            }
            //AutoMappingBedDA.UpdateOverDateData();

            //if ("1".Equals(hotelcomparisonEntity.AutoHotelComparisonDBEntity[0].SaveType))
            //{
            //    DataSet dsMailData = AutoMappingBedDA.GetMailDataList();

            //    string strMailBody = "";
            //    string strMailSubject = "今日{0}家酒店价格过高 " + DateTime.Now.ToShortDateString();

            //    if (dsMailData.Tables.Count > 0 && dsMailData.Tables["Master"].Rows.Count > 0)
            //    {
            //        strMailSubject = String.Format(strMailSubject, dsMailData.Tables["Master"].Rows[0]["BHLID"].ToString());
            //    }
            //    else
            //    {
            //        strMailSubject = String.Format(strMailSubject, "0");
            //    }

            //    strMailBody = SetMailBodyData(dsMailData);

            //    SendMailExpress(strMailBody, strMailSubject);
            //}

            return dsResult.Tables[0].Rows.Count;
        }
コード例 #12
0
        public static void PusMsgHelping(DataSet dsPusMsgList)
        {
            int iMaxRows = int.Parse(ConfigurationManager.AppSettings["MaxRows"].ToString());
            bool bSleep = (dsPusMsgList.Tables[0].Rows.Count > iMaxRows) ? true : false;
            //Variables you may need to edit:
            //---------------------------------

            //True if you are using sandbox certificate, or false if using production
            bool sandbox = ("0".Equals(ConfigurationManager.AppSettings["Sandbox"].ToString())) ? true : false;

            //Put your device token in here
            //  string testDeviceToken = "bc9eb0ca6fedb7967ab7563a36fc197b90df3c99aae38db335cb152b7377fdb9";

            //Put your PKCS12 .p12 or .pfx filename here.
            // Assumes it is in the same directory as your app
            string p12File = GetAppValue("p12File");// "aps_production_identity.p12";

            //This is the password that you protected your p12File
            //  If you did not use a password, set it as null or an empty string
            string p12FilePassword = GetAppValue("p12FilePassword");//"123456";

            //Number of notifications to send
            //int count = 1000;

            //Number of milliseconds to wait in between sending notifications in the loop
            // This is just to demonstrate that the APNS connection stays alive between messages

            //string numberFileName = GetAppValue("tokenFile");

            string content = "";// GetAppValue("content");

            //bool isTest = GetAppValue("isTest") == "true" ? true : false;

            //Actual Code starts below:
            //--------------------------------

            string p12Filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p12File);

            //string numFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, numberFileName);

            //string[] numberList = ReadFile(numFile).Contains(',') ? ReadFile(numFile).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) : new string[] { };

            //NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword, 1, bSleep);
            NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword, 1);

            service.SendRetries = 1; //5 retries before generating notificationfailed event
            service.ReconnectDelay = 5000; //5 seconds

            service.Error += new NotificationService.OnError(service_Error);
            service.NotificationTooLong += new NotificationService.OnNotificationTooLong(service_NotificationTooLong);

            service.BadDeviceToken += new NotificationService.OnBadDeviceToken(service_BadDeviceToken);
            service.NotificationFailed += new NotificationService.OnNotificationFailed(service_NotificationFailed);
            service.NotificationSuccess += new NotificationService.OnNotificationSuccess(service_NotificationSuccess);
            service.Connecting += new NotificationService.OnConnecting(service_Connecting);
            service.Connected += new NotificationService.OnConnected(service_Connected);
            service.Disconnected += new NotificationService.OnDisconnected(service_Disconnected);

            //The notifications will be sent like this:
            //		Testing: 1...
            //		Testing: 2...
            //		Testing: 3...
            // etc...
            //for (int i = 0; i < numberList.Length; i++)
            int sleepBetweenNotifications = (bSleep) ? Convert.ToInt32(GetAppValue("sleepBetweenNotificationsshot")) : Convert.ToInt32(GetAppValue("sleepBetweenNotifications")); //100;

            string strResult = string.Empty;

            CommonEntity commonEntity = new CommonEntity();
            commonEntity.LogMessages = new Common.Logger.LogMessage();
            commonEntity.LogMessages.Userid = "JOB System";
            commonEntity.LogMessages.Username = "******";

            commonEntity.CommonDBEntity = new List<CommonDBEntity>();

            for (int i = 0; i < dsPusMsgList.Tables[0].Rows.Count ; i++)
            {
                try
                {
                    //if (!PushTicketMsgDA.CheckPushPlanActionHistory(taskID, dsPusMsgList.Tables[0].Rows[i]["DEVICETOKEN"].ToString().Trim()))
                    //{
                    //    continue;
                    //}
                    CommonDBEntity dbParm = new CommonDBEntity();
                    dbParm.Event_Type = "Que Ticket Push发送";

                    if ("0".Equals(dsPusMsgList.Tables[0].Rows[i]["TYPE"].ToString().Trim()))
                    {
                        content = String.Format(GetAppValue("oneContent"), dsPusMsgList.Tables[0].Rows[i]["amount"].ToString().Trim());
                    }
                    else
                    {
                        content = String.Format(GetAppValue("twoContent"), dsPusMsgList.Tables[0].Rows[i]["amount"].ToString().Trim());
                    }
                    dbParm.Event_Content = "Que Push发送Telphone: " + dsPusMsgList.Tables[0].Rows[i]["TELPHONE"].ToString().Trim() + "Que Push发送Devicetoken: " + dsPusMsgList.Tables[0].Rows[i]["DEVICETOKEN"].ToString().Trim() + "Que Push发送内容: " + content;
                    //Create a new notification to send
                    Notification alertNotification = new Notification(dsPusMsgList.Tables[0].Rows[i]["DEVICETOKEN"].ToString().Trim());

                    alertNotification.Payload.Alert.Body = string.Format(content);
                    alertNotification.Payload.Sound = "default";
                    alertNotification.Payload.Badge = 1;

                    //Queue the notification to be sent
                    if (service.QueueNotification(alertNotification, bSleep))
                    {
                        strResult = "发送成功";
                        Console.WriteLine("Notification Queued!");
                        writeFile(logFile1, content + "Notification Queued!" + dsPusMsgList.Tables[0].Rows[i]["DEVICETOKEN"].ToString().Trim());
                    }
                    else
                    {
                        strResult = "发送失败";
                        Console.WriteLine("Notification Failed to be Queued!");
                        writeFile(logFile1, content + "Notification Failed to be Queued!" + dsPusMsgList.Tables[0].Rows[i]["DEVICETOKEN"].ToString().Trim());
                    }

                    dbParm.Event_ID = dsPusMsgList.Tables[0].Rows[i]["TELPHONE"].ToString().Trim();
                    dbParm.Event_Result = strResult;
                    commonEntity.CommonDBEntity.Add(dbParm);
                    //PushTicketMsgDA.InsertPushPlanActionHistory(taskID, dsPusMsgList.Tables[0].Rows[i]["TELPHONE"].ToString().Trim(), dsPusMsgList.Tables[0].Rows[i]["DEVICETOKEN"].ToString().Trim(), strResult);

                    //Sleep in between each message
                    //if (i < numberList.Length)
                    //{
                    Console.WriteLine("Sleeping " + sleepBetweenNotifications + " milliseconds before next Notification...");
                    System.Threading.Thread.Sleep(sleepBetweenNotifications);
                    //}
                }
                catch (Exception ex)
                {
                    //  Log King
                    CommonDA.InsertEventHistoryError(dsPusMsgList.Tables[0].Rows[i]["TELPHONE"].ToString().Trim(), "Que Push发送Telphone: " + dsPusMsgList.Tables[0].Rows[i]["TELPHONE"].ToString().Trim() + "Que Push发送Devicetoken: " + dsPusMsgList.Tables[0].Rows[i]["DEVICETOKEN"].ToString().Trim() + "Que Push发送异常: " + ex.Message);
                    Console.WriteLine(ex.Message);
                    continue;
                }
            }

            Console.WriteLine("Cleaning Up...");
            writeFile(logFile, "Cleaning Up...");
            //First, close the service.
            //This ensures any queued notifications get sent befor the connections are closed
            service.Close();

            //Clean up
            service.Dispose();

            Console.WriteLine("Done!");
            writeFile(logFile, "Done");
            //Console.WriteLine("Press enter to exit...");
            //writeFile(logFile, "Press enter to exit...");
            //Console.ReadLine();

            CommonDA.InsertEventHistory(commonEntity);
        }
コード例 #13
0
        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;
        }
コード例 #14
0
        private static int AutoSelect(AutoHotelPlanEntity autogotelplanEntity)
        {
            DataSet dsResult = new DataSet();
            dsResult = AutoHotelPlanDA.AutoListSelect(autogotelplanEntity);
            int iCount = 0;
            string PlanID=string.Empty;
            string Status=string.Empty;
            string Action=string.Empty;
            string Result=string.Empty;
            string Username = string.Empty;
            //string strToDay = DateTime.Now.ToShortDateString();
            //int strToWeek = (int)DateTime.Now.DayOfWeek + 1;
            //string strDayTemp = string.Empty;
            string strWeekTemp = string.Empty;
            string strTypeNm = string.Empty;
            string strTypeTime = string.Empty;
            foreach (DataRow drRow in dsResult.Tables[0].Rows)
            {
                if ("0".Equals(drRow["Type"].ToString().Trim()))
                {
                    strTypeNm = "立即保存";
                    strTypeTime = drRow["Plan_DTime"].ToString().Trim();
                    PlanID = drRow["HPID"].ToString().Trim();
                    Status = "2";
                    Action = "1";
                    Result = ApplySalesRoomService(drRow, drRow["Type"].ToString().Trim());
                    Username = drRow["Create_User"].ToString().Trim();
                    AutoHotelPlanDA.UpdateSalesPlanEventStatus(PlanID, Status, Action, Result, Username);
                    AutoHotelPlanDA.UpdateSalesPlanEventJobStatus(drRow["JID"].ToString().Trim(), Action, Result, Username);
                    iCount = iCount + 1;
                }
                else if ("1".Equals(drRow["Type"].ToString().Trim()))
                {
                    strTypeNm = "定时保存";
                    strTypeTime = drRow["Plan_DTime"].ToString().Trim();
                    PlanID = drRow["HPID"].ToString().Trim();
                    Status = "2";
                    Action = "1";
                    Result = ApplySalesRoomService(drRow, drRow["Type"].ToString().Trim());
                    Username = drRow["Create_User"].ToString().Trim();
                    AutoHotelPlanDA.UpdateSalesPlanEventStatus(PlanID, Status, Action, Result, Username);
                    AutoHotelPlanDA.UpdateSalesPlanEventJobStatus(drRow["JID"].ToString().Trim(), Action, Result, Username);
                    iCount = iCount + 1;
                }
                else if ("2".Equals(drRow["Type"].ToString().Trim()))
                {
                    strTypeNm = "每日自动更新";
                    strTypeTime = drRow["PlanTime"].ToString().Trim();
                    //strDayTemp = drRow["EndDtime"].ToString().Trim();
                    strWeekTemp = drRow["Week_List"].ToString().Trim();

                    Status = (DateTime.Parse(drRow["JPDTime"].ToString().Trim()) == DateTime.Parse(drRow["PlanPlanEnd"].ToString().Trim() + " " + drRow["PlanTime"].ToString().Trim())) ? "2" : "1";
                    PlanID = drRow["HPID"].ToString().Trim();
                    Action = ChkNumerVal(drRow["Action"].ToString().Trim()).ToString();
                    Result = ApplySalesRoomService(drRow, drRow["Type"].ToString().Trim());
                    Username = drRow["Create_User"].ToString().Trim();
                    AutoHotelPlanDA.UpdateSalesPlanEventStatus(PlanID, Status, Action, Result, Username);
                    AutoHotelPlanDA.UpdateSalesPlanEventJobStatus(drRow["JID"].ToString().Trim(), "1", Result, Username);
                    iCount = iCount + 1;
                }

                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["HPID"].ToString().Trim();
                string conTent = "销售计划 运行一次 - 计划ID:{0} 更新方式:{1} 定时执行时间:{2} 定时开始日期:{3} 定时结束日期:{4} 星期详情:{5} 修改时间:{6} 修改人:{7}";
                conTent = string.Format(conTent, drRow["HPID"].ToString().Trim(), strTypeNm, strTypeTime, drRow["StartDtime"].ToString().Trim(), drRow["EndDtime"].ToString().Trim(), strWeekTemp, drRow["Update_Time"].ToString().Trim(), drRow["Update_User"].ToString().Trim());
                commonDBEntity.Event_Content = conTent;
                commonDBEntity.Event_Result = Result;
                _commonEntity.CommonDBEntity.Add(commonDBEntity);
                CommonBP.InsertEventHistory(_commonEntity);
            }
            return iCount;
        }