コード例 #1
0
 public void Log(string dolurl, string question, string suggestion, string posttype)
 {
     base.Response.AddHeader("Access-Control-Allow-Origin", "*");
     base.Response.AddHeader("Access-Control-Allow-Methods", "POST,OPTIONS");
     base.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type");
     base.Response.AddHeader("Access-Control-Allow-Credentials", "false");
     base.Response.AddHeader("Access-Control-Max-Age", "60");
     try
     {
         if ((((((base.Request.QueryString.AllKeys.Contains <string>("dolurl") & base.Request.QueryString.AllKeys.Contains <string>("question")) & base.Request.QueryString.AllKeys.Contains <string>("posttype")) && (dolurl.Trim() != "")) && ((question.ToUpper() == "YES") || (question.ToUpper() == "NO"))) && (!(posttype.ToUpper() != "C") || !(posttype.ToUpper() != "Q"))) && (((dolurl != null) && (question != null)) && (suggestion != null)))
         {
             bool   flag       = false;
             string agencyCode = this.GetAgencyCode(dolurl);
             if (question.ToUpper() == "YES")
             {
                 flag = true;
             }
             if (posttype.ToUpper() == "Q")
             {
                 Response entity = new Response
                 {
                     Url      = dolurl,
                     Positive = new bool?(flag),
                     UtcDate  = DateTime.Now,
                     Agency   = agencyCode
                 };
                 tdc.Responses.InsertOnSubmit(entity);
                 tdc.SubmitChanges();
             }
             else if (posttype.ToUpper() == "C")
             {
                 Comment comment = new Comment
                 {
                     Url      = dolurl,
                     Positive = new bool?(flag),
                     Comment1 = suggestion,
                     UtcDate  = DateTime.Now,
                     Agency   = agencyCode
                 };
                 tdc.Comments.InsertOnSubmit(comment);
                 tdc.SubmitChanges();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        /// <summary>
        /// 查询物流单号
        /// </summary>
        /// <returns></returns>
        public JsonResult InquireDeliveryNum()
        {
            string DeliveryNum = Request["DeliveryNum"];
            string DLogUID     = Request["DLogUID"];
            string CurrentRole = Request["CurrentRole"];

            Delivery delivery = new Identity().GetDeliveryInfo(DeliveryNum);

            //查询成功
            if (delivery.msg == "查询成功")
            {
                //保存物流信息
                using (var db = new trackingDataContext())
                {
                    var log = db.Tracking.Where(l => l.DLogUID == DLogUID).FirstOrDefault();
                    if (log != null)
                    {
                        //角色身份
                        if (CurrentRole == "Recipient")
                        {
                            log.RecipientTrackingNum  = delivery.No;
                            log.RecipientTrackingDate = DateTime.Now;
                        }
                        else if (CurrentRole == "Sponsor")
                        {
                            log.SponsorTrackingNum  = delivery.No;
                            log.SponsorTrackingDate = DateTime.Now;
                        }
                    }
                    db.SubmitChanges();
                }
            }

            return(Json(delivery.msg, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        /// <summary>
        /// 接受申请
        /// </summary>
        /// <returns></returns>
        public ActionResult AgreeDeal(string DLogUID = "")
        {
            //首先改变订单状态
            using (var db = new LogDealDataContext())
            {
                var log = db.LogDeal.Where(d => d.DLogUID == Guid.Parse(DLogUID)).FirstOrDefault();
                if (log != null)
                {
                    log.DealStatus = "交易中";
                    db.SubmitChanges();

                    //接受申请后,两个物品需要加入订单号
                    var treasureR = repository.Treasures.Where(t => t.TreasureUID == Guid.Parse(log.TreasureRecipientID)).FirstOrDefault();
                    var treasureS = repository.Treasures.Where(t => t.TreasureUID == Guid.Parse(log.TreasureSponsorID)).FirstOrDefault();
                    if (treasureR != null)
                    {
                        treasureR.DLogUID = log.DLogUID.ToString();
                        repository.SaveTreasure(treasureR);
                    }
                    if (treasureS != null)
                    {
                        treasureS.DLogUID = log.DLogUID.ToString();
                        repository.SaveTreasure(treasureS);
                    }
                }
            }
            //使其他包含这两样物品的交易申请失效


            //在物流信息中添加一项
            using (var db = new trackingDataContext())
            {
                //当前订单号不存在时
                if (db.Tracking.Where(t => t.DLogUID == DLogUID).FirstOrDefault() == null)
                {
                    db.Tracking.InsertOnSubmit(new Tracking
                    {
                        DLogUID = DLogUID
                    });
                    db.SubmitChanges();
                }
            }

            return(RedirectToAction("DealingLog", "Account"));
        }