Example #1
0
        // <summary>
        /// 扫码页面中的上传图片
        /// </summary>
        /// <returns></returns>
        public ActionResult Upload()
        {
            try
            {
                string             FlowerArrangementId = Request["FlowerArrangementId"];
                HttpPostedFileBase files = Request.Files["file"];
                Utility.Log.WriteTextLog("报错", "", "", "", files == null ? "true" : "fasle");
                if (files == null)
                {
                    return(Json("Faild", JsonRequestBehavior.AllowGet));
                }


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

                string FilePath = Utility.ChangeText.SaveUploadPicture(files, "img");

                // Sys_FlowerArrangement.UpdateUploadImg(FilePath, int.Parse(FlowerArrangementId));
                Business.Sys_FlowerChange Sys_FlowerChange = new Business.Sys_FlowerChange();
                Model.FlowerChange        FlowerChange     = new Model.FlowerChange();
                //增加一条更换记录
                FlowerChange.WorkUsersId       = Utility.ChangeText.GetUsersId();
                FlowerChange.WorkUsersRealName = Utility.ChangeText.GetRealName();
                FlowerChange.OwnedUsersId      = FlowerArrangement.belongUsersId;
                FlowerChange.OwnedCompany      = FlowerArrangement.OwnedCompany;

                FlowerChange.FlowerTreatmentType = "更换花卉";
                FlowerChange.UsersId             = Utility.ChangeText.GetUsersId();
                FlowerChange.Photo  = FilePath;
                FlowerChange.Number = Utility.ChangeText.OrderIdCreate();
                FlowerChange.State  = "未更换";


                FlowerChange.FlowerType      = FlowerArrangement.FlowerType;
                FlowerChange.PlacingPosition = FlowerArrangement.arrangement;
                FlowerChange.time            = DateTime.Now;
                FlowerChange.Sum             = 1;
                Sys_FlowerChange.InsertFlowerChange(FlowerChange);
                Model.Wx_SendMsg Wx_SendMsg = new Model.Wx_SendMsg()
                {
                    template_id = "MU4CvSNXPYTMjhGJdWuWNvpc5Ls2VPAmcaST4lWrTaM",
                    touser      = Utility.ChangeText.GetOpenId(),
                    url         = "http://www.thuay.com/MFlower/AddFlowersPhotoInfo?Number=" + FlowerChange.Number,
                    data        = new
                    {
                        first    = new { value = "您好!已经有客户(" + FlowerChange.OwnedCompany + ")需要服务,请尽快前往。", color = "#173177" },
                        keyword1 = new { value = FlowerChange.Number, 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 = "更换内容:" + FlowerChange.Reamrk + ".点击此消息,进行补录更换后图片。", color = "#173177" },
                    }
                };
                WxHelper.WxMain.SendMsg(JsonConvert.SerializeObject(Wx_SendMsg));
                return(Json(new { result = "OK", msg = "更换花卉成功" }, "text/html", JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Utility.Log.WriteTextLog("报错", "", "", "", ex.ToString());
                return(null);
            }
        }
Example #2
0
        public ActionResult ChangeFlowers(Model.FlowerChange FlowerChange)
        {
            try
            {
                //如果当前是客户提交申请,则直接记录工作服务对象OwnedCompany,
                //如果是工作人自己发起,则需要选择一个属于自己服务范围的公司进行操作
                Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin();
                string          openId    = "";
                Model.UserAdmin UserAdmin = Sys_UserAdmin.GetUserAdminByUserId(Utility.ChangeText.GetUsersId());

                if (!UserAdmin.RoleCode.Contains("Customer"))
                {
                    if (Request["deptSelectItems"].Split('&').Length > 1)
                    {
                        openId = Utility.ChangeText.GetOpenId();
                        FlowerChange.WorkUsersId       = Utility.ChangeText.GetUsersId();
                        FlowerChange.WorkUsersRealName = Utility.ChangeText.GetRealName();
                        FlowerChange.OwnedUsersId      = int.Parse(Request["deptSelectItems"].Split('&')[0]);
                        FlowerChange.OwnedCompany      = Request["deptSelectItems"].Split('&')[1];
                    }
                }
                else
                {
                    //是客户自己本身提交
                    FlowerChange.OwnedUsersId      = Utility.ChangeText.GetUsersId();
                    FlowerChange.OwnedCompany      = UserAdmin.OwnedCompany;
                    FlowerChange.WorkUsersId       = int.Parse(UserAdmin.WorkUsersId);
                    FlowerChange.WorkUsersRealName = UserAdmin.RealName;
                    openId = UserAdmin.OpenId;
                }
                FlowerChange.FlowerTreatmentType = "更换花卉";
                FlowerChange.UsersId             = Utility.ChangeText.GetUsersId();
                HttpPostedFileBase file = Request.Files["attach_path"];
                FlowerChange.Photo = Utility.ChangeText.SaveUploadPicture(file, "change");

                Business.Sys_FlowerChange Sys_FlowerChange = new Business.Sys_FlowerChange();
                FlowerChange.Number = Utility.ChangeText.OrderIdCreate();
                FlowerChange.State  = "未更换";
                Model.Wx_SendMsg Wx_SendMsg = new Model.Wx_SendMsg()
                {
                    template_id = "MU4CvSNXPYTMjhGJdWuWNvpc5Ls2VPAmcaST4lWrTaM",
                    touser      = openId,
                    url         = "http://www.thuay.com/MFlower/AddFlowersPhotoInfo?Number=" + FlowerChange.Number,
                    data        = new
                    {
                        first    = new { value = "您好!已经有客户(" + FlowerChange.OwnedCompany + ")需要服务,请尽快前往。", color = "#173177" },
                        keyword1 = new { value = FlowerChange.Number, 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 = "更换内容:" + FlowerChange.Reamrk + ".点击此消息,进行补录更换后图片。", color = "#173177" },
                    }
                };
                WxHelper.WxMain.SendMsg(JsonConvert.SerializeObject(Wx_SendMsg));
                if (Sys_FlowerChange.InsertFlowerChange(FlowerChange))
                {
                    ViewData["success"] = "操作成功";
                    return(View());
                }
            }
            catch (Exception ex)
            {
                Utility.Log.WriteTextLog("更换花卉", "ChangeFlowers", "更换花卉", "post", ex.Message);
            }

            return(View());
        }