Example #1
0
        /// <summary>
        /// 查询服务前图片
        /// </summary>
        /// <returns></returns>
        public ActionResult ServerBefor(string arrid, string ownedUsersId)
        {
            Model.FlowerTreatment        FlowerTreatment     = new Model.FlowerTreatment();
            Business.Sys_FlowerTreatment Sys_FlowerTreatment = new Business.Sys_FlowerTreatment();
            int userid = Utility.ChangeText.GetUsersId();

            FlowerTreatment = Sys_FlowerTreatment.GetModelbyArrid(arrid, ownedUsersId, userid.ToString());
            //只有服务前图片
            if (FlowerTreatment != null && FlowerTreatment.Photo != null && FlowerTreatment.ChangePhoto == null)
            {
                return(Json(new { result = "OK", data = FlowerTreatment }, "text/html", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { result = "OK", data = "" }, "text/html", JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
        /// <summary>
        /// 扫码页面中的上传图片养护
        ///</summary>
        /// <returns></returns>
        public ActionResult Upload()
        {
            try
            {
                string             FlowerArrangementId = Request["FlowerArrangementId"];
                string             remarks             = Request["remarks"];
                HttpPostedFileBase files = Request.Files["file"];
                if (files == null)
                {
                    Utility.Log.WriteTextLog("扫码页面上传图片养护", "FlowerArrangementId", FlowerArrangementId, "files", files == null ? "true" : "fasle");
                    return(Json("Faild", JsonRequestBehavior.AllowGet));
                }

                Business.Sys_FlowerArrangement Sys_FlowerArrangement = new Business.Sys_FlowerArrangement();
                Model.FlowerArrangement        FlowerArrangement     = Sys_FlowerArrangement.GetModel(FlowerArrangementId);

                Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin();

                Business.Sys_FlowerTreatment Sys_FlowerTreatment = new Business.Sys_FlowerTreatment();
                int userid = Utility.ChangeText.GetUsersId();
                Model.FlowerTreatment FTreatment = Sys_FlowerTreatment.GetModelbyArrid(FlowerArrangement.id.ToString(), FlowerArrangement.belongUsersId.ToString(), userid.ToString());
                if (FTreatment == null)//有未上传服务后图,不可以再提交
                {
                    string FilePath = Utility.ChangeText.SaveUploadPicture(files, "img");
                    Model.FlowerTreatment FlowerTreatment = new Model.FlowerTreatment();
                    FlowerTreatment.FlowerTreatmentType = "服务前";
                    FlowerTreatment.State                  = "未完成";
                    FlowerTreatment.UsersId                = userid;
                    FlowerTreatment.ArrangementId          = FlowerArrangement.id.ToString();
                    FlowerTreatment.FlowerNumber           = FlowerArrangement.ShopId.ToString();
                    FlowerTreatment.OwnedUsersId           = FlowerArrangement.belongUsersId.ToString();
                    FlowerTreatment.UserRealName           = Utility.ChangeText.GetRealName();
                    FlowerTreatment.FlowerTreatmentAddress = FlowerArrangement.arrangement;
                    Model.UserAdmin UserAdmin = Sys_UserAdmin.GetUserAdminByUserId(Convert.ToInt32(FlowerTreatment.OwnedUsersId));
                    FlowerTreatment.OwnedUsersRealName = UserAdmin.RealName;
                    FlowerTreatment.OwnedCompany       = UserAdmin.OwnedCompany;
                    FlowerTreatment.LogoPhoto          = UserAdmin.LogoPhoto;
                    FlowerTreatment.Photo      = FilePath; //提交图片
                    FlowerTreatment.ContentMsg = remarks;  //提交内容

                    if (Sys_FlowerTreatment.InsertFlowerTreatment(FlowerTreatment))
                    {
                        Model.Wx_SendMsg Wx_SendMsg = new Model.Wx_SendMsg()
                        {
                            template_id = "MU4CvSNXPYTMjhGJdWuWNvpc5Ls2VPAmcaST4lWrTaM",
                            touser      = Utility.ChangeText.GetOpenId(),
                            url         = "http://www.thuay.com/MMain/GetArrangementInfo?way=Arrangement&ArrangementId=" + FlowerArrangementId,
                            data        = new
                            {
                                first    = new { value = "您好!已经有客户(" + FlowerTreatment.OwnedCompany + ")需要服务,请尽快前往。", color = "#173177" },
                                keyword1 = new { value = FlowerTreatment.FlowerNumber, color = "#173177" },
                                keyword2 = new { value = "养护花卉", color = "#173177" },
                                keyword3 = new { value = "养护", color = "#173177" },
                                keyword4 = new { value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), color = "#173177" },
                                remark   = new { value = "详细内容:" + FlowerTreatment.ContentMsg + ".点击此消息,查看详情。", color = "#173177" },
                            }
                        };
                        WxHelper.WxMain.SendMsg(JsonConvert.SerializeObject(Wx_SendMsg));
                    }
                    return(Content("1"));
                }
                else
                {
                    return(Content("0"));//未完成
                }
            }
            catch (Exception ex)
            {
                Utility.Log.WriteTextLog("扫码页面上传图片养护报错", "FlowerArrangementId", "MFlower", "Upload", ex.ToString());
                return(null);
            }
        }