public string RemoveRequirement(DtoRemoveRequirement model)//(long id) { //验证参数 var validateRes = ValidateParamModel(); if (validateRes != null) { return(JsonHelper.ToJsJson(validateRes)); } SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); #region 调用E田接口,更新订单状态 //ResponseResult<T_FARMER_PUBLISHED_DEMAND> farmerrequirement = JsonHelper.FromJsonTo<ResponseResult<T_FARMER_PUBLISHED_DEMAND>>(result); //if (farmerrequirement.IsSuccess == true && farmerrequirement.Entity != null) //{ // //取消订单 // if (farmerrequirement.Entity.DemandTypeId != (int)DuPont.Entity.Enum.FarmerDemandType.SellGrain && farmerrequirement.Entity.DemandTypeId != (int)DuPont.Entity.Enum.FarmerDemandType.SellSilage) // { // Task taskasync = new Task(() => UpdateCancleOrder(farmerrequirement.Entity)); // taskasync.Start(); // } //} #endregion return(result); }
/// <summary> /// 农机手应大农户的需求(向大农户需求响应表添加记录) /// </summary> /// <param name="id">需求id</param> /// <param name="userId">农机手id</param> /// <returns>JsonResult.</returns> public string ReplyRequirement(DtoReplyRequirement model)//(long id, long userId) { //验证参数 var validateRes = ValidateParamModel(); if (validateRes != null) { return(JsonHelper.ToJsJson(validateRes)); } SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); //#region 调用E田接口,更新订单状态 //ResponseResult<T_FARMER_DEMAND_RESPONSE_RELATION> farmerrequirement = JsonHelper.FromJsonTo<ResponseResult<T_FARMER_DEMAND_RESPONSE_RELATION>>(result); //if (farmerrequirement.IsSuccess == true && farmerrequirement.Entity != null) //{ // //接受订单 // Task taskasync = new Task(() => AcceptOrder(farmerrequirement.Entity)); // taskasync.Start(); //} //#endregion return(result); }
public string CancelFarmerRequirement(DtoCancelFarmerRequirement model)//(long id, long userId) { try { var validateRes = ValidateParamModel(); SetJsonHeader(); var content = GetPostParameters(); string logErrstring = DateTime.Now.ToString("\r\n---------MM/dd/yyyy HH:mm:ss,fff---------\r\n") + "靠谱作业农机手取消订单"; string parmeters = null; foreach (var item in content) { parmeters += item.Key + ":" + item.Value + "\r\n"; } IOHelper.WriteLogToFile("Operator/CancelFarmerRequirement" + logErrstring + "\r\n" + parmeters, RelativePath() + @"\DuPontRequestEtLog"); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); } catch (Exception ex) { IOHelper.WriteLogToFile("Operator/CancelFarmerRequirement" + ex.Message, RelativePath() + @"\DuPontRequestEtLog"); return(""); } }
/// <summary> /// 修改城市接口 /// </summary> /// <param name="userId">用户id</param> /// <param name="name">城市名称</param> /// <returns></returns> public JsonResult ModifyUserWeatherCity(string userId, string name) { var result = new ResponseResult <object>(); if (string.IsNullOrEmpty(userId)) { result.IsSuccess = false; result.Message = "用户id为空"; return(Json(result)); } if (string.IsNullOrEmpty(name)) { result.IsSuccess = false; result.Message = "城市名称为空"; return(Json(result)); } var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); //发送请求 var resPoststr = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); ResponseResult <object> resPost = JsonHelper.FromJsonTo <ResponseResult <object> >(resPoststr); resPost.Entity = null; return(Json(resPost)); }
/// <summary> /// 保存玉米价格 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void timeryumi_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { Stopwatch sw = new Stopwatch(); sw.Start(); int intHour = e.SignalTime.Hour; if (intHour >= 9 && intHour <= 12) { try { IOHelper.WriteLogToFile("yumiprogram start \r\n", workUrl + @"\DuPontServiceyumiLog"); Dictionary <string, string> content = new Dictionary <string, string>(); string modlist = HttpAsynchronousTool.CustomHttpWebRequestPost(PresentationApiurl + "/Common/GetModPriceUrl", content, GetCertificationFilePath(), GetCertificationPwd()); var everydayurllist = JsonHelper.FromJsonTo <ResponseResult <CornDayUrlModel> >(modlist); if (everydayurllist.Entity != null) { Dictionary <string, string> urlcontent = new Dictionary <string, string>(); urlcontent.Add("everydayurl", everydayurllist.Entity.dayurllist[0].href); string result = HttpAsynchronousTool.CustomHttpWebRequestPost(PresentationApiurl + "/Common/GetCornPrices", urlcontent, GetCertificationFilePath(), GetCertificationPwd()); } sw.Stop(); TimeSpan ProGramts = sw.Elapsed; string Protimespan = ProGramts.Seconds + "秒" + ProGramts.Milliseconds + "毫秒"; IOHelper.WriteLogToFile("运行" + Protimespan + "\r\n", workUrl + @"\DuPontServiceyumiLog"); } catch (Exception ex) { string logErrstring = DateTime.Now.ToString("\r\n---------MM/dd/yyyy HH:mm:ss,fff---------\r\n") + ex.Message; IOHelper.WriteLogToFile(logErrstring, workUrl + @"\DuPontServiceyumiLog"); } } }
/// <summary> /// 调用E田接口,评价靠谱作业农机手 /// </summary> /// <param name="t_FARMER_DEMAND_RESPONSE_RELATION"></param> /// <returns></returns> private object CommentOrderForOperator(T_FARMER_DEMAND_RESPONSE_RELATION t_FARMER_DEMAND_RESPONSE_RELATION) { try { DtoCommentFarmerDemandModel updatemodel = new DtoCommentFarmerDemandModel(); updatemodel.Id = t_FARMER_DEMAND_RESPONSE_RELATION.DemandId; updatemodel.CommentString = t_FARMER_DEMAND_RESPONSE_RELATION.Comments; updatemodel.Score = t_FARMER_DEMAND_RESPONSE_RELATION.Score; #region 调用内网服务返回数据 var content = new Dictionary <string, string>(); content.Add("Id", updatemodel.Id.ToString()); content.Add("UserId", t_FARMER_DEMAND_RESPONSE_RELATION.UserId.ToString());//农机手id var resultmodel = PostStandardWithSameControllerAction <DtoCommentFarmerDemandModel>("FarmerRequirement", "CommentOrderForOperator", content); if (resultmodel.IsSuccess == true) { if (resultmodel.Entity != null) { updatemodel.OperatorUserId = resultmodel.Entity.OperatorUserId; updatemodel.FarmerUserId = resultmodel.Entity.FarmerUserId; } } #endregion #region 调用E田接口 var etcontent = new Dictionary <string, string>(); etcontent = ModelHelper.GetPropertyDictionary <DtoCommentFarmerDemandModel>(updatemodel); //加密要传递的参数 Dictionary <string, string> rurlcontent = EncryptDictionary(etcontent); //e田接口地址 string Apiurl = ConfigHelper.GetAppSetting("EtApiUrl"); string Eturl = Apiurl + "/wei/work/dupont/evaluate_driver.jsp"; //证书的路径 var etcertification = GetCertificationFilePath(); //证书的密码 var etcertificationPwd = GetCertificationPwd(); var etresult = HttpAsynchronousTool.CustomHttpWebRequestPost(Eturl, rurlcontent, etcertification, etcertificationPwd); var resultModel = JsonHelper.FromJsonTo <ETResponseResult <object> >(etresult); if (resultModel.IsSuccess == true) { //写文件确认我方调用e田接口完成 string logErrstring = DateTime.Now.ToString("\r\n---------MM/dd/yyyy HH:mm:ss,fff---------\r\n") + "先锋帮大农户评价靠谱作业的农机手"; string parmeters = null; foreach (var item in rurlcontent) { parmeters += item.Key + ":" + item.Value + "\r\n"; } IOHelper.WriteLogToFile("FarmerRequirement/CommentRequirementForOperator" + logErrstring + "\r\n" + parmeters, RelativePath() + @"\DuPontRequestEtLog"); } return(resultModel.IsSuccess.ToString()); #endregion } catch (Exception ex) { IOHelper.WriteLogToFile("FarmerRequirement/CommentOrderForOperator:" + ex.Message, RelativePath() + @"\DuPontRequestEtLog"); return(""); } }
public string CommentRequirement(DtoCommentRequirement model)//(long id, string OperatorUserid, long FarmerUserId, string commentString, int score,SourceType) { //验证参数 var validateRes = ValidateParamModel(); if (validateRes != null) { return(JsonHelper.ToJsJson(validateRes)); } SetJsonHeader(); var content = GetPostParameters(); var result = string.Empty; //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); //先锋帮用户 //E田调用时,model.SourceType.ToString()=="0" 的值永远为0,可能是请求头格式的问题 try { string sourcetype = content["SourceType"].ToString(); if (sourcetype == "0") { result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); #region 调用E田接口,更新订单状态 //ResponseResult<T_FARMER_DEMAND_RESPONSE_RELATION> farmerrequirement = JsonHelper.FromJsonTo<ResponseResult<T_FARMER_DEMAND_RESPONSE_RELATION>>(result); //if (farmerrequirement.IsSuccess == true && farmerrequirement.Entity != null) //{ // //评价大农户订单 // Task taskasync = new Task(() => CommentOrder(farmerrequirement.Entity)); // taskasync.Start(); //} #endregion } else //E田 { string logErrstring = DateTime.Now.ToString("\r\n---------MM/dd/yyyy HH:mm:ss,fff---------\r\n") + "靠谱作业的农机手评价先锋帮大农户"; string parmeters = null; foreach (var item in content) { parmeters += item.Key + ":" + item.Value + "\r\n"; } IOHelper.WriteLogToFile(logErrstring + "\r\n" + parmeters, RelativePath() + @"\DuPontRequestEtLog"); //靠谱作业的农机手评价先锋帮大农户 string Apiurl = ConfigHelper.GetAppSetting(DataKey.RemoteApiForRelease); string url = Apiurl + "api" + "/Operator/EtCommentRequirement"; result = HttpAsynchronousTool.CustomHttpWebRequestPost(url, content, certification, certificationPwd); } } catch (Exception ex) { return(ex.Message); } return(result); }
/// <summary> /// 接受大农户的需求单 /// </summary> /// <param name="t_FARMER_DEMAND_RESPONSE_RELATION"></param> /// <returns></returns> private string AcceptOrder(T_FARMER_DEMAND_RESPONSE_RELATION t_FARMER_DEMAND_RESPONSE_RELATION) { DtoUpdateFarmerDemandModel updatemodel = new DtoUpdateFarmerDemandModel(); updatemodel.Id = t_FARMER_DEMAND_RESPONSE_RELATION.DemandId; updatemodel.OrderState = 100502; #region 调用内网服务返回数据 var content = new Dictionary <string, string>(); content.Add("Id", updatemodel.Id.ToString()); content.Add("UserId", t_FARMER_DEMAND_RESPONSE_RELATION.UserId.ToString());//农机手id //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var resultmodel = PostStandardWithSameControllerAction <DtoUpdateFarmerDemandModel>("Operator", "AcceptOrder", content);//发布后带api的 if (resultmodel.IsSuccess == true) { if (resultmodel.Entity != null) { updatemodel.OperatoName = resultmodel.Entity.OperatoName; updatemodel.FarmerName = resultmodel.Entity.FarmerName; } } #endregion #region 调用E田接口 var etcontent = new Dictionary <string, string>(); etcontent = ModelHelper.GetPropertyDictionary <DtoUpdateFarmerDemandModel>(updatemodel); //加密要传递的参数 Dictionary <string, string> rurlcontent = EncryptDictionary(etcontent); //e田接口地址 string Apiurl = ConfigHelper.GetAppSetting("EtApiUrl"); string Eturl = Apiurl + "/wei/work/dupont/order_status.jsp"; //证书的路径 var etcertification = GetCertificationFilePath(); //证书的密码 var etcertificationPwd = GetCertificationPwd(); var etresult = HttpAsynchronousTool.CustomHttpWebRequestPost(Eturl, rurlcontent, etcertification, etcertificationPwd); var resultModel = JsonHelper.FromJsonTo <ETResponseResult <object> >(etresult); if (resultModel.IsSuccess == true) { //写文件确认我方调用e田接口完成 string logErrstring = DateTime.Now.ToString("\r\n---------MM/dd/yyyy HH:mm:ss,fff---------\r\n") + "先锋帮的农机手接受订单"; string parmeters = null; foreach (var item in rurlcontent) { parmeters += item.Key + ":" + item.Value + "\r\n"; } IOHelper.WriteLogToFile("Operator/ReplyRequirement" + logErrstring + parmeters, RelativePath() + @"\DuPontRequestEtLog"); } return(resultModel.IsSuccess.ToString()); #endregion }
public string Register(RegisterInput model) { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); string result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
public JsonResult AddUser(UserViewModel model) { CheckPermission(GetLoginInfo().User.Id, CurrentUrl, true); if (ModelState.IsValid) { if (model.Province == "0" || model.City == "0" || model.Region == "0") { return(Json(new { success = false, responseText = "省、市、区县为必选字段!" })); } var postParas = new Dictionary <string, string>(); postParas.Add("AuditUserId", GetLoginInfo().User.Id.ToString()); Dictionary <string, string> usermodel = Utility.ModelHelper.GetPropertyDictionary <UserViewModel>(model); foreach (var item in usermodel) { postParas.Add(item.Key, item.Value); } //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); if (postParas.ContainsKey(DataKey.UserId) == false) { postParas.Add(DataKey.UserId, GetLoginInfo().User.Id.ToString()); } var responseString = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), postParas, certification, certificationPwd); var responseObj = JsonHelper.FromJsonTo <ResponseResult <object> >(responseString); if (responseObj.IsSuccess == true) { //TempData["Message"] = "添加成功!"; //return RedirectToAction("List"); HttpContext.Items[DataKey.RemoveSessionCookie] = "yes"; Session.RemoveAll(); return(Json(new { success = true, responseText = "添加成功" })); } else { //ModelState.AddModelError("", responseObj.Message); return(Json(new { success = false, responseText = responseObj.Message })); } } else { //ModelState.AddModelError("", "添加失败-参数无效!"); //return View(); var error = ModelState.Values.Where(ms => ms.Errors.Count > 0).First().Errors.First(); return(Json(new { success = false, responseText = error.ErrorMessage })); } }
public string UpdateBusinessRequirementState() { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); string result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
public string GetPersonNumber(DtoGetPersonNumber model)//(long id, int roleType) { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
public string AppVersion(DtoAppVersion model)//(string platform) { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
public string GetToken(string Userid, string Password) { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); string result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
public string PublishedForFarmerByTime(int pageIndex, int pageSize, int type, string orderfield) { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
/// <summary> /// 关闭需求 /// </summary> /// <param name="id">需求编号</param> /// <returns>System.Web.Mvc.JsonResult.</returns> public string CloseRequirement(DtoRemoveRequirement model)//(long id) { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
public string MyReply(DtoMyReply model)//(int pageindex, int pagesize, int isclosed, long userid) { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
public string GetDictionaryItems(DtoGetDictionaryItems model)//(string Code) { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
public string GetModList(int pageIndex, int pageSize = 10) { var content = GetPostParameters(); SetJsonHeader(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); //发送请求 var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
/// <summary> /// 获取天气预报接口 /// </summary> /// <param name="userId">用户id</param> /// <param name="name">城市名称</param> /// <returns></returns> public string GetSearchWeather(string userId, string name) { var content = GetPostParameters(); SetJsonHeader(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); //发送请求 var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
public string CommentDetail(DtoCommentDetail model)//(long userid, int roletype, int pageindex, int pagesize) { SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
/// <summary> /// 先锋帮大农户取消需求订单 /// </summary> /// <param name="t_FARMER_PUBLISHED_DEMAND"></param> /// <returns></returns> private string UpdateCancleOrder(T_FARMER_PUBLISHED_DEMAND t_FARMER_PUBLISHED_DEMAND) { DtoUpdateFarmerDemandModel updatemodel = new DtoUpdateFarmerDemandModel(); updatemodel.Id = t_FARMER_PUBLISHED_DEMAND.Id; updatemodel.OrderState = t_FARMER_PUBLISHED_DEMAND.PublishStateId; updatemodel.FarmerName = t_FARMER_PUBLISHED_DEMAND.CreateUserId.ToString(); #region 调用内网服务返回数据 //var content = new Dictionary<string, string>(); //content.Add("Id", updatemodel.Id.ToString()); ////农机手id //var resultmodel = PostStandardWithSameControllerAction<DtoUpdateFarmerDemandModel>("Operator", "AcceptOrder", content); //if (resultmodel.IsSuccess == true) //{ // if (resultmodel.Entity != null) // { // updatemodel.OperatoName = resultmodel.Entity.OperatoName; // updatemodel.FarmerName = resultmodel.Entity.FarmerName; // } //} #endregion #region 调用E田接口 var etcontent = new Dictionary <string, string>(); etcontent = ModelHelper.GetPropertyDictionary <DtoUpdateFarmerDemandModel>(updatemodel); //加密要传递的参数 Dictionary <string, string> rurlcontent = EncryptDictionary(etcontent); //e田接口地址 string Apiurl = ConfigHelper.GetAppSetting("EtApiUrl"); string Eturl = Apiurl + "/wei/work/dupont/order_status.jsp"; //证书的路径 var etcertification = GetCertificationFilePath(); //证书的密码 var etcertificationPwd = GetCertificationPwd(); var etresult = HttpAsynchronousTool.CustomHttpWebRequestPost(Eturl, rurlcontent, etcertification, etcertificationPwd); var resultModel = JsonConvert.DeserializeObject <ETResponseResult <object> >(etresult); if (resultModel.IsSuccess == true) { //写文件确认我方调用e田接口完成 string logErrstring = DateTime.Now.ToString("\r\n---------MM/dd/yyyy HH:mm:ss,fff---------\r\n") + "先锋帮大农户取消需求订单"; string parmeters = null; foreach (var item in rurlcontent) { parmeters += item.Key + ":" + item.Value + "\r\n"; } IOHelper.WriteLogToFile(logErrstring + "\r\n" + parmeters, RelativePath() + @"\DuPontRequestEtLog"); } return(resultModel.IsSuccess.ToString()); #endregion }
public string GetWeatherbyCityName1(string cityname) { var parameters = GetPostParameters(); parameters.Add("city", cityname); SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }
/// <summary> /// 返回E田Token /// </summary> /// <returns></returns> public string ReturnCustomToken() { Dictionary <string, string> content = new Dictionary <string, string>(); string username = ConfigHelper.GetAppSetting("EtUserName"); string password = ConfigHelper.GetAppSetting("EtPassword"); content.Add("UserName", username); content.Add("Password", password); string Apiurl = ConfigHelper.GetAppSetting("EtApiUrl"); string url = Apiurl + "/wei/work/dupont/login.jsp"; var modlist = HttpAsynchronousTool.CustomHttpWebRequestPost(url, content, GetCertificationFilePath(), GetCertificationPwd()); ResponseResult <TokenModel> token = JsonConvert.DeserializeObject <ResponseResult <TokenModel> >(modlist); TokenModel m = token.Entity; return(m.token); }
/// <summary> /// 更新订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { Stopwatch sw = new Stopwatch(); sw.Start(); int intHour = e.SignalTime.Hour; int intMinute = e.SignalTime.Minute; int intSecond = e.SignalTime.Second; if (intHour == 23 && intMinute == 50) { long rows = 0; try { IOHelper.WriteLogToFile("program start \r\n", workUrl + @"\DuPontServiceLog"); Dictionary <string, string> content = new Dictionary <string, string>(); string orderlist = HttpAsynchronousTool.CustomHttpWebRequestPost(PresentationApiurl + "/Account/UpdateFarmerRequirementState", content, GetCertificationFilePath(), GetCertificationPwd()); var result = JsonHelper.FromJsonTo <ResponseResult <object> >(orderlist); if (result.IsSuccess == true) { rows = result.TotalNums; } sw.Stop(); TimeSpan ProGramts = sw.Elapsed; string Protimespan = ProGramts.Seconds + "秒" + ProGramts.Milliseconds + "毫秒"; string logstring = DateTime.Now.ToString("\r\n---------MM/dd/yyyy HH:mm:ss,fff---------\r\n") + "修改大农户需求" + rows + "条"; IOHelper.WriteLogToFile(logstring + "运行" + Protimespan + "\r\n", workUrl + @"\DuPontServiceLog"); //更新产业商订单 string borderlist = HttpAsynchronousTool.CustomHttpWebRequestPost(PresentationApiurl + "/Account/UpdateBusinessRequirementState", content, GetCertificationFilePath(), GetCertificationPwd()); var bresult = JsonHelper.FromJsonTo <ResponseResult <object> >(orderlist); if (bresult.IsSuccess == true) { rows = bresult.TotalNums; } sw.Stop(); TimeSpan bProGramts = sw.Elapsed; string bProtimespan = ProGramts.Seconds + "秒" + ProGramts.Milliseconds + "毫秒"; string blogstring = DateTime.Now.ToString("\r\n---------MM/dd/yyyy HH:mm:ss,fff---------\r\n") + "修改产业商需求" + rows + "条"; IOHelper.WriteLogToFile(blogstring + "运行" + Protimespan + "\r\n", workUrl + @"\DuPontServiceLog"); } catch (Exception ex) { string logErrstring = DateTime.Now.ToString("\r\n---------MM/dd/yyyy HH:mm:ss,fff---------\r\n") + ex.Message; IOHelper.WriteLogToFile(logErrstring, workUrl + @"\DuPontServiceLog"); } } }
public string CommentRequirement(string order) { try { string certification; string certificationPwd; Dictionary <string, string> content; order = HandleString(order, out certification, out certificationPwd, out content); content = EncryptDictionary(content); string result = HttpAsynchronousTool.CustomHttpWebRequestPost(bgApiServerUrl + "Operator/CommentRequirement", content, certification, certificationPwd); System.Web.HttpContext.Current.Application["num"] = (int)System.Web.HttpContext.Current.Application["num"] + 1; return(result); } catch (Exception ex) { return(ex.Message); } }
/// <summary> /// 日志列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public ActionResult List(int pageIndex = 1, int pageSize = 10) { var userId = GetLoginInfo().User.Id; //请求的地址 string postUrl = GetPostUrl("List"); //请求的参数 var postParas = new Dictionary <string, string>() { { "pageIndex", pageIndex.ToString() }, { "pageSize", pageSize.ToString() }, { "userId", userId.ToString() } }; //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); if (postParas.ContainsKey(DataKey.UserId) == false) { postParas.Add(DataKey.UserId, GetLoginInfo().User.Id.ToString()); } var responseStrResult = HttpAsynchronousTool.CustomHttpWebRequestPost(postUrl, postParas, certification, certificationPwd); var responseObjResult = JsonHelper.FromJsonTo <ResponseResult <ListLogViewModelWithoutPager> >(responseStrResult); if (responseObjResult.IsSuccess) { foreach (var item in responseObjResult.Entity.listModel) { item.CreateTime = TimeHelper.GetChinaLocalTime(item.CreateTime); } var logVerification = new ListLogViewModel(); logVerification.Pager = new PagedList <string>(new string[0], responseObjResult.PageIndex, responseObjResult.PageSize, (int)responseObjResult.TotalNums); logVerification.listModel = responseObjResult.Entity.listModel; return(View(logVerification)); } else { TempData["Error"] = responseObjResult.Message; return(null); } }
public string SaveRequirement(DtoSaveRequirement model)//(long id, long userId, int type, int cropId, int acreage, string description, string date, //string address, string detailAddress, string PhoneNumber, double ExpectedStartPrice = 0, double ExpectedEndPrice = 0) { //验证参数 var validateRes = ValidateParamModel(); if (validateRes != null) { return(JsonHelper.ToJsJson(validateRes)); } SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); //try //{ // #region 调用E田接口,传订单数据 // ResponseResult<T_FARMER_PUBLISHED_DEMAND> farmerrequirement = JsonHelper.FromJsonTo<ResponseResult<T_FARMER_PUBLISHED_DEMAND>>(result); // if (farmerrequirement.IsSuccess == true && farmerrequirement.Entity != null) // { // //干活需求单 // if (farmerrequirement.Entity.DemandTypeId != (int)DuPont.Entity.Enum.FarmerDemandType.SellGrain && farmerrequirement.Entity.DemandTypeId != (int)DuPont.Entity.Enum.FarmerDemandType.SellSilage) // { // Task taskasync = new Task(() => ReturnOrderModel(farmerrequirement.Entity)); // taskasync.Start(); // } // } // #endregion //} //catch //{ // return result; //} return(result); }
public ActionResult UpdUserInfo(T_USER model, Dictionary <int, byte?> demandLevelInfoList) { var postParas = new Dictionary <string, string>(); //postParas.Add("UserId", GetLoginInfo().User.Id.ToString()); postParas.Add("UserId", model.Id.ToString()); Dictionary <string, string> usermodel = Utility.ModelHelper.GetPropertyDictionary <T_USER>(model); foreach (var item in usermodel) { postParas.Add(item.Key, item.Value); } for (var item = 0; item < demandLevelInfoList.Count; item++) { var tempItem = demandLevelInfoList.ElementAt(item); postParas.Add("demandLevelInfoList[" + item + "].Key", tempItem.Key.ToString()); postParas.Add("demandLevelInfoList[" + item + "].Value", tempItem.Value.ToString()); } //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); if (postParas.ContainsKey(DataKey.UserId) == false) { postParas.Add(DataKey.UserId, GetLoginInfo().User.Id.ToString()); } var responseString = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), postParas, certification, certificationPwd); var responseObj = JsonHelper.FromJsonTo <ResponseResult <object> >(responseString); if (responseObj.IsSuccess == true) { TempData["Message"] = "修改成功!"; return(RedirectToAction("List")); } else { ModelState.AddModelError("", responseObj.Message); return(View("GetUpdData")); } }
public string SaveOperatorRequirement(DtoSaveOperatorRequirement model) { //验证参数 var validateRes = ValidateParamModel(); if (validateRes != null) { return(JsonHelper.ToJsJson(validateRes)); } SetJsonHeader(); var content = GetPostParameters(); //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); var result = HttpAsynchronousTool.CustomHttpWebRequestPost(GetCurrentUrl(this), content, certification, certificationPwd); return(result); }