Exemple #1
0
 /// <summary>
 /// 开始养护花卉
 /// </summary>
 /// <param name="arrid">摆放的id</param>
 /// <returns></returns>
 public ActionResult StartCurFlowers(string arrid, string ownedUsersId)
 {
     try
     {
         Business.Sys_FlowerTreatment Sys_FlowerTreatment = new Business.Sys_FlowerTreatment();
         int userid = Utility.ChangeText.GetUsersId();
         Business.Sys_FlowerArrangement Sys_FlowerArrangement = new Business.Sys_FlowerArrangement();
         Model.FlowerArrangement        FlowerArrangement     = Sys_FlowerArrangement.GetModel(arrid);
         Model.FlowerTreatment          FTreatment            = Sys_FlowerTreatment.GetModelbyid(arrid.ToString(), ownedUsersId, userid.ToString());
         if (FTreatment == null || (FTreatment.endtime != null && FTreatment.State == "已完成"))//有了结束养护时间说明这个记录完成了
         {
             Model.FlowerTreatment  FlowerTreatment = new Model.FlowerTreatment();
             Business.Sys_UserAdmin Sys_UserAdmin   = new Business.Sys_UserAdmin();
             FlowerTreatment.FlowerTreatmentType = "开始养护";
             FlowerTreatment.State                  = "未完成";
             FlowerTreatment.UsersId                = userid;
             FlowerTreatment.ArrangementId          = arrid;
             FlowerTreatment.FlowerNumber           = FlowerArrangement.ShopId.ToString();
             FlowerTreatment.OwnedUsersId           = ownedUsersId;
             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.starttime          = DateTime.Now;//记录开始养护时间
             ////同一登录人,同一公司,一天只能提交一次
             //StringBuilder stb = new StringBuilder();
             //if (userid != 0)
             //{
             //    stb.Append(" t.UsersId=" + userid + "");
             //}
             //if (!string.IsNullOrEmpty(FlowerTreatment.OwnedUsersId))
             //{
             //    stb.Append(" and t.OwnedUsersId='" + FlowerTreatment.OwnedUsersId + "'");
             //}
             //string dt = DateTime.Now.ToShortDateString();
             //{
             //    stb.Append(" and time>'" + dt + "'");
             //}
             //stb.Append(" and starttime !='' ");
             //Utility.Log.WriteTextLog("开始养护花卉", "arrid", arrid, "stb", stb.ToString());
             //if (Sys_FlowerTreatment.FlowerTreatmentList(stb.ToString()).Count == 0)
             //{
             Sys_FlowerTreatment.InsertFlowerTreatment(FlowerTreatment);
             return(Content("1"));
             //}
             //else
             //{
             //    return Content("0");//今天已经开始养护过了
             //}
         }
     }
     catch {
     }
     return(Json(new { resule = '1' }, JsonRequestBehavior.AllowGet));
 }
Exemple #2
0
        public ActionResult Delete(string id)
        {
            Business.Sys_FlowerArrangement Sys_FlowerArrangement = new Business.Sys_FlowerArrangement();
            Model.FlowerArrangement        FlowerArrangement     = Sys_FlowerArrangement.GetModel(id);
            string path = Server.MapPath("~") + FlowerArrangement.ImgORCodePath;

            //删除二维码图片
            if (System.IO.File.Exists(path))
            {
                System.IO.File.Delete(path);
            }
            Sys_FlowerArrangement.Delete(id);
            return(Content(""));
        }
Exemple #3
0
        public ActionResult Add(Model.FlowerArrangement FlowerArrangement)
        {
            //ViewData["GetOwnedCompanyList"] = GetOwnedCompanyList();
            //ViewData["GetShopList"] = GetShopList();
            if (Request.Files["attach_path"] != null && Request.Files["attach_path"].ToString() != "")
            {
                HttpPostedFileBase file = Request.Files["attach_path"];
                FlowerArrangement.Photo = Utility.ChangeText.SaveUploadPicture(file, "attach");
            }
            Business.Sys_FlowerArrangement Sys_FlowerArrangement = new Business.Sys_FlowerArrangement();
            int id = Sys_FlowerArrangement.Add(FlowerArrangement);

            Sys_FlowerArrangement.UpdateImgORCodePath(CreateORCode(id), id);
            return(Content(""));
        }
Exemple #4
0
 public ActionResult Edit(Model.FlowerArrangement FlowerArrangement)
 {
     //ViewData["GetOwnedCompanyList"] = GetOwnedCompanyList(FlowerArrangement.belongUsersId); ViewData["GetShopList"] = GetShopList(FlowerArrangement.id);
     Business.Sys_FlowerArrangement Sys_FlowerArrangement = new Business.Sys_FlowerArrangement();
     if (Request.Files["attach_path"] != null && Request.Files["attach_path"].ToString() != "")
     {
         HttpPostedFileBase file = Request.Files["attach_path"];
         FlowerArrangement.Photo = Utility.ChangeText.SaveUploadPicture(file, "attach");
     }
     Sys_FlowerArrangement.Edit(FlowerArrangement);
     if (string.IsNullOrEmpty(FlowerArrangement.ImgORCodePath))
     {
         Sys_FlowerArrangement.UpdateImgORCodePath(CreateORCode(FlowerArrangement.id), FlowerArrangement.id);
     }
     //Response.Write("<script>parent.layer.closeAll();</script>");
     return(Content(""));
 }
        public ActionResult Edit(Model.FlowerArrangement FlowerArrangement)
        {
            //ViewData["GetOwnedCompanyList"] = GetOwnedCompanyList(FlowerArrangement.belongUsersId); ViewData["GetShopList"] = GetShopList(FlowerArrangement.id);
            Business.Sys_FlowerArrangement Sys_FlowerArrangement = new Business.Sys_FlowerArrangement();
            if (Request.Files["attach_path"] != null && Request.Files["attach_path"].ToString() != "")
            {
                HttpPostedFileBase file = Request.Files["attach_path"];
                FlowerArrangement.Photo = Utility.ChangeText.SaveUploadPicture(file, "attach");
            }
            Sys_FlowerArrangement.Edit(FlowerArrangement);
            //if (string.IsNullOrEmpty(FlowerArrangement.ImgORCodePath))
            //    Sys_FlowerArrangement.UpdateImgORCodePath(CreateORCode(FlowerArrangement.id), FlowerArrangement.id);
            string path = Server.MapPath("~") + FlowerArrangement.ImgORCodePath;

            //删除二维码图片
            if (!System.IO.File.Exists(path) || string.IsNullOrEmpty(FlowerArrangement.ImgORCodePath))
            {
                Sys_FlowerArrangement.UpdateImgORCodePath(CreateORCode(FlowerArrangement.id), FlowerArrangement.id);
            }
            return(Content(""));
        }
Exemple #6
0
        public bool Edit(Model.FlowerArrangement FlowerArrangement)
        {
            const string sql =
                @" UPDATE  FlowerArrangement SET arrangement=@arrangement,FlowerType=@FlowerType, Photo=@Photo,Specifications=@Specifications,
UnitPrice=@UnitPrice,Count=@Count,Total=@Total,Remark=@Remark,belongUsersId=@belongUsersId,ShopId=@ShopId  WHERE Id=@id";

            return(Factory.DBHelper.ExecSQL(SQLConString, sql.ToString(), new DynamicParameters(new
            {
                FlowerArrangement.arrangement,
                FlowerArrangement.FlowerType,
                FlowerArrangement.Photo,
                FlowerArrangement.Specifications,
                FlowerArrangement.UnitPrice,
                FlowerArrangement.Count,
                FlowerArrangement.Total,
                FlowerArrangement.Remark,
                FlowerArrangement.belongUsersId,
                FlowerArrangement.ShopId,
                FlowerArrangement.id
            })));
        }
Exemple #7
0
        public int Add(Model.FlowerArrangement FlowerArrangement)
        {
            const string sql =
                @"INSERT INTO FlowerArrangement(arrangement,FlowerType,Photo,Specifications,UnitPrice,Count,Total,Remark,belongUsersId,ShopId) 
 VALUES(@arrangement,@FlowerType,@Photo,@Specifications,@UnitPrice,@Count,@Total,@Remark,@belongUsersId,@ShopId);SELECT @@identity";
            //var p = new DynamicParameters();
            //p.Add("@id", dbType: DbType.Int32, direction: ParameterDirection.Output);
            var info = Factory.DBHelper.ExecSqlGetId(SQLConString, sql.ToString(), new DynamicParameters(new
            {
                FlowerArrangement.arrangement,
                FlowerArrangement.FlowerType,
                FlowerArrangement.Photo,
                FlowerArrangement.Specifications,
                FlowerArrangement.UnitPrice,
                FlowerArrangement.Count,
                FlowerArrangement.Total,
                FlowerArrangement.Remark,
                FlowerArrangement.belongUsersId,
                FlowerArrangement.ShopId,
            }));

            return(info);
        }
Exemple #8
0
        public ActionResult GetArrangementInfo(string ArrangementId)
        {
            try
            {
                string id = Request["ArrangementId"];
                Business.Sys_FlowerArrangement Sys_FlowerArrangement = new Business.Sys_FlowerArrangement();
                Model.FlowerArrangement        FlowerArrangement     = Sys_FlowerArrangement.GetModel(id);
                if (FlowerArrangement.belongUsersId != 0)
                {
                    //DateTime dt = Sys_FlowerArrangement.GetFlowerTreatmentModel(FlowerArrangement.belongUsersId.ToString()).time;
                    Model.FlowerTreatment        FlowerTreatment     = new Model.FlowerTreatment();
                    Business.Sys_FlowerTreatment Sys_FlowerTreatment = new Business.Sys_FlowerTreatment();
                    FlowerTreatment = Sys_FlowerTreatment.GetModelbyOwnid(FlowerArrangement.belongUsersId.ToString());
                    if (FlowerTreatment != null)
                    {
                        if (FlowerTreatment.starttime != null && FlowerTreatment.endtime == null) //没有结束养护时间
                        {
                            DateTime dt = (DateTime)FlowerTreatment.starttime;                    //开始养护时间
                            ViewBag.Treattime     = dt;
                            ViewBag.PlanTreatTime = dt.AddDays(7);
                        }
                    }
                }
                //if (Session["RoleCode"] != null && Session["RoleCode"].ToString() == "Tourist")
                //{
                //    ViewData["IsTourist"] = 1;
                //}

                //当操作人不是对应绑定客户与超级管理员时,判断是否为养护人员,如果为养护人员则判断是否有权限操作此更换花卉
                if (Session["RoleCode"] != null)
                {
                    #region 原来的逻辑
                    //if (Session["RoleCode"].ToString() != "Customer" && Session["RoleCode"].ToString() != "SuperAdministrator")
                    //{
                    //    if (Session["RoleCode"].ToString() == "yanghu")
                    //    {
                    //        Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin();
                    //        List<Model.UserAdmin> UserAdminList = new List<Model.UserAdmin>();

                    //        UserAdminList = Sys_UserAdmin.GetUserAdminListByRoleCode("Customer", Utility.ChangeText.GetUsersId());
                    //        //判断所属客户权限中是否包含此客户
                    //        UserAdminList = UserAdminList.Where(x => x.ID == FlowerArrangement.belongUsersId).ToList();
                    //        if (UserAdminList.Count() > 0)
                    //        {
                    //            ViewData["IsAllower"] = 1;
                    //        }
                    //        else
                    //        {
                    //            ViewData["IsAllower"] = 0;
                    //        }
                    //    }
                    //    else
                    //    {
                    //        ViewData["IsAllower"] = 0;
                    //    }
                    //}
                    //else {
                    //    ViewData["IsAllower"] = 1;
                    //}
                    #endregion
                    if (Session["RoleCode"].ToString() != "Customer")
                    {
                        ViewData["IsAllower"] = 1;
                    }
                    else
                    {
                        ViewData["IsAllower"] = 0;
                    }
                }

                return(View(FlowerArrangement));
            }
            catch (Exception ex)
            {
                Utility.Log.WriteTextLog("扫码页面", "MMain", ex.Message, "GetArrangementInfo", ex.ToString());
                return(null);
            }
        }
Exemple #9
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);
            }
        }
Exemple #10
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);
            }
        }