public static AutoMsgUserExcelEntity ApplySendMsgService(AutoMsgUserExcelEntity automsgcancelordEntity)
        {
            AutoMsgCancelOrdDBEntity dbParm = (automsgcancelordEntity.AutoMsgCancelOrdDBEntity.Count > 0) ? automsgcancelordEntity.AutoMsgCancelOrdDBEntity[0] : new AutoMsgCancelOrdDBEntity();

            string DataString = "";
            DataString = DataString + "{\"method\":\"save\",\"data\":{\"syscode\":\"" + "CMS" + "\",\"reqid\":\"" + dbParm.CreateUser +"\",\"bizcode\":\"" + "CMS-JOB-用户短信提示" +"\",";
            DataString = DataString + "\"mobiles\":\"" + dbParm.CreateUser + "\",\"msg\":\"" + dbParm.Note1 + "\",";
            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;
        }
        public static string CommonCallWebUrl(string strUrl)
        {
            string strJson = string.Empty;
            try
            {
                CallWebPage callWebPage = new CallWebPage();
                strJson = callWebPage.CallWebByURL(strUrl, "");
            }
            catch
            {

            }
            return strJson;
        }
        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;
        }
Ejemplo n.º 4
0
        public static string UploadFile(string file)
        {
            //string uploadPath = HttpContext.Current.Server.MapPath(context.Request.Params["folder"]) + "\\";

            if (file != null)
            {
                //if (!Directory.Exists(uploadPath))
                //{
                //    Directory.CreateDirectory(uploadPath);
                //}
                //string fullname = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
                //file.SaveAs(string.Format("{0}\\{1}", uploadPath, fullname));

                //string extname = Path.GetExtension(file.FileName);
                //string filename = fullname;// file.FileName;
                FileStream localfile = File.Open(file, FileMode.Open);
                string extname = Path.GetExtension(file);
                //HttpPostedFile postFile = new HttpPostedFile();

                byte[] bit = PhotoToBinary(localfile);

                CallWebPage call = new CallWebPage();
                string imgServer = System.Configuration.ConfigurationManager.AppSettings["ImageServer"].ToString();
                string strJson = call.CallWebByURL(imgServer + "?imageType=" + extname.Replace(".", "") + "&imageKind=4&apiVersion=2.2", bit, "POST");//
                if (!string.IsNullOrEmpty(strJson))
                {
                    JObject o = JObject.Parse(strJson);
                    string picUrl = o.SelectToken("result").SelectToken("url").ToString().Trim('"');
                    string HtpPathBak = o.SelectToken("result").SelectToken("urlBak").ToString().Trim('"');
                    return picUrl;
                    //try
                    //{
                    //    //ImageEntity _imageEntity = new ImageEntity();
                    //    //_imageEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
                    //    //_imageEntity.LogMessages.Userid = UserSession.Current.UserAccount;
                    //    //_imageEntity.LogMessages.Username = UserSession.Current.UserDspName;
                    //    //_imageEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

                    //    //_imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                    //    //ImageDBEntity imageDBEntity = new ImageDBEntity();
                    //    //imageDBEntity.HotelID = hotelID;//酒店ID
                    //    //imageDBEntity.Resolution = filename;//图片名
                    //    //imageDBEntity.Source = extname;//后缀名
                    //    //imageDBEntity.HtpPath = picUrl;//图片路径
                    //    //imageDBEntity.HtpPathBak = HtpPathBak;//备份路径
                    //    //_imageEntity.ImageDBEntity.Add(imageDBEntity);
                    //    //ImageBP.InsertImage(_imageEntity);
                    //}
                    //catch (Exception ex)
                    //{
                    //    Console.Write(ex.Message.ToString());
                    //}
                }
                else
                {
                    return "";
                }
                //下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失
            }
            else
            {
                return "";
            }
        }