/// <summary>
        /// 农机手评价大农户
        /// </summary>
        /// <param name="t_FARMER_DEMAND_RESPONSE_RELATION"></param>
        /// <returns></returns>
        private string CommentOrder(T_FARMER_DEMAND_RESPONSE_RELATION t_FARMER_DEMAND_RESPONSE_RELATION)
        {
            try
            {
                DtoUpdateFarmerDemandModel updatemodel = new DtoUpdateFarmerDemandModel();
                updatemodel.Id            = t_FARMER_DEMAND_RESPONSE_RELATION.DemandId;
                updatemodel.OrderState    = 100508;
                updatemodel.CommentString = t_FARMER_DEMAND_RESPONSE_RELATION.CommentsFarmer;
                updatemodel.Score         = t_FARMER_DEMAND_RESPONSE_RELATION.ScoreFarmer;
                #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 <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        = 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/CommentRequirement" + logErrstring + parmeters, RelativePath() + @"\DuPontRequestEtLog");
                }
                return(resultModel.IsSuccess.ToString());

                #endregion
            }
            catch (Exception ex)
            {
                IOHelper.WriteLogToFile("Operator/CommentOrder:" + ex.Message, RelativePath() + @"\DuPontRequestEtLog");
                return("");
            }
        }
Example #2
0
        /// <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
        }
Example #3
0
        /// <summary>
        /// 重新整理订单数据
        /// </summary>
        /// <param name="model">需求表</param>
        /// <param name="UserId">农机手id</param>
        /// <param name="t_FARMER_DEMAND_RESPONSE_RELATION">应答表</param>
        /// <param name="type">0:接单,1:评价订单</param>
        /// <author>ww</author>
        /// <returns></returns>
        public JsonResult AcceptOrder(T_FARMER_PUBLISHED_DEMAND model, long UserId, T_FARMER_DEMAND_RESPONSE_RELATION t_FARMER_DEMAND_RESPONSE_RELATION, int type)
        {
            using (ResponseResult <object> result = new ResponseResult <object>())
            {
                DtoUpdateFarmerDemandModel updatemodel = new DtoUpdateFarmerDemandModel();
                try
                {
                    updatemodel.FarmerName = model.CreateUserId.ToString();
                    //查询用户名称
                    T_USER umodel = new DuPont.Repository.UserRepository().GetByWhere(x => x.Id == UserId);
                    if (umodel != null)
                    {
                        updatemodel.OperatoName = umodel.UserName;
                    }
                    if (type == 0)//接单
                    {
                        updatemodel.Id         = model.Id;
                        updatemodel.OrderState = 100502;
                    }
                    else if (type == 1)//评价需求
                    {
                        updatemodel.Id            = t_FARMER_DEMAND_RESPONSE_RELATION.DemandId;
                        updatemodel.OrderState    = 100508;
                        updatemodel.CommentString = t_FARMER_DEMAND_RESPONSE_RELATION.CommentsFarmer;
                        updatemodel.Score         = t_FARMER_DEMAND_RESPONSE_RELATION.ScoreFarmer;
                    }
                    #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/AcceptOrder" + logErrstring + parmeters, RelativePath() + @"\DuPontRequestEtLog");
                    }

                    #endregion
                    result.IsSuccess = true;
                    result.Entity    = updatemodel;
                }
                catch
                {
                    result.IsSuccess = false;
                }
                return(Json(result));
            }
        }