Exemple #1
0
        /// <summary>
        /// 花卉
        /// </summary>
        /// <returns></returns>
        public ActionResult GetFlowerList()
        {
            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            List <Model.Flower> FlowerList = Sys_Flower.GetFlowerList();

            return(Json(FlowerList, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
 /// <summary>
 /// 批量删除
 /// </summary>
 /// <returns></returns>
 public ActionResult Delete()
 {
     try
     {
         Business.Sys_Flower            Sys_Flower    = new Business.Sys_Flower();
         Business.Sys_FlowerArrangement Sys_FlowerArr = new Business.Sys_FlowerArrangement();
         string ids               = Request["id"];
         string strwhere          = "and id in(" + ids + ")";
         List <Model.Flower> list = Sys_Flower.GetFlowerList(ids.Split(',').Length, 1, strwhere);
         foreach (var item in list)
         {
             if (Sys_FlowerArr.GetListCount("and shopid =" + item.id) == 0)
             {
                 if (Sys_Flower.DeleteFlowerWatch(item.id.ToString()))
                 {
                     if (!string.IsNullOrEmpty(item.FlowerWatchPhoto))
                     {
                         DeleteFlowerPhoto(item.FlowerWatchPhoto);
                     }
                 }
             }
         }
         return(Content("True"));
     }
     catch (Exception ex)
     {
         return(Content("Fasle"));
     }
 }
Exemple #3
0
        public ActionResult Edit()
        {
            string id = Request["id"];

            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            return(View(Sys_Flower.GetFlower(id)));
        }
Exemple #4
0
        public ActionResult Edit(Model.Flower Flower)
        {
            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            //Model.Flower Flowers = Sys_Flower.GetFlowerByFlowerNumber(Flower.FlowerNumber);

            if (Request.Files["attach_path"] != null)
            {
                HttpPostedFileBase file = Request.Files["attach_path"];
                if (!string.IsNullOrEmpty(file.FileName))
                {
                    DeleteFlowerPhoto(Flower.FlowerWatchPhoto);
                    Flower.FlowerWatchPhoto = Utility.ChangeText.SaveUploadPicture(file, "FlowerPhoto");
                }
            }
            //else
            //{
            //    Flower.FlowerWatchPhoto = Flowers.FlowerWatchPhoto;
            //}
            //ViewData["success"] = "修改失败";
            if (Sys_Flower.UpdateFlowerWatch(Flower))
            {
                // ViewData["success"] = "修改成功";
            }
            Response.Write("<script>parent.layer.closeAll();</script>");
            return(View());
        }
Exemple #5
0
        //
        // GET: /Shop/
        public ActionResult Index()
        {
            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            StringBuilder       sb         = new StringBuilder();

            return(View(Sys_Flower.GetFlowerList(10, 1, sb.ToString())));
        }
Exemple #6
0
        public ActionResult Details()
        {
            string id = Request["id"];

            Business.Sys_Flower        Sys_Flower        = new Business.Sys_Flower();
            Business.Sys_OrdersManaage Sys_OrdersManaage = new Business.Sys_OrdersManaage();
            return(View(Sys_Flower.GetFlower(id)));
        }
Exemple #7
0
        public ActionResult PayOrdersNow(string Remark)
        {
            #region 生成订单
            string ids = Request["ids"].TrimEnd(',');
            Business.Sys_Flower        Sys_Flower        = new Business.Sys_Flower();
            Business.Sys_OrdersManaage Sys_OrdersManaage = new Business.Sys_OrdersManaage();
            string[] idarry        = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string   FlowerNum     = Request["FlowerNums"];
            string[] FlowerNumarry = FlowerNum.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            string ConsigneAaddress = Request["DetailedAddress"];
            string ConsigneeName    = Request["ConsigneeName"];
            string ConsigneePhone   = Request["ConsigneePhone"];
            //唯一的订单
            Model.Orders Orders = new Model.Orders();
            Orders.UsersId          = int.Parse(userid);
            Orders.CreateTime       = DateTime.Now;
            Orders.OrdersState      = 1;
            Orders.OrderId          = Utility.ChangeText.OrderIdCreate();
            Orders.GoodsSum         = int.Parse(Request["goodnum"]);// 总件数
            Orders.ConsigneeName    = ConsigneeName;
            Orders.ConsigneePhone   = ConsigneePhone;
            Orders.ConsigneAaddress = ConsigneAaddress;
            //详情列表
            List <Model.OrdersDetails> OrdersDetailsList = new List <Model.OrdersDetails>();
            for (int j = 0; j < idarry.Length; j++)
            {
                //每一种花
                Model.Flower Flower = Sys_Flower.GetFlower(idarry[j]);
                Orders.SellingPrice += Flower.FlowerSalesPrice * int.Parse(FlowerNumarry[j]);
                Orders.CostPrice    += Flower.FlowerCostPrice * int.Parse(FlowerNumarry[j]);
                //每种花对应的数量
                for (int i = 0; i < int.Parse(FlowerNumarry[j]); i++)
                {
                    Model.OrdersDetails OrdersDetails = new Model.OrdersDetails();
                    OrdersDetails.OrderId          = Orders.OrderId;
                    OrdersDetails.FlowerNumber     = Flower.FlowerNumber;
                    OrdersDetails.FlowerWatchName  = Flower.FlowerWatchName;
                    OrdersDetails.FlowerWatchPhoto = Flower.FlowerWatchPhoto;
                    OrdersDetails.SellingPrice     = Flower.FlowerSalesPrice;
                    OrdersDetails.SellingNum       = 1;
                    OrdersDetails.CostPrice        = Flower.FlowerCostPrice;
                    OrdersDetailsList.Add(OrdersDetails);
                }
            }
            Model.OrdersLog OrdersLog = new Model.OrdersLog();
            OrdersLog.OrdersId    = Orders.OrderId;
            OrdersLog.OrdersState = 1;
            OrdersLog.UserName    = Utility.ChangeText.GetUserName();
            OrdersLog.Remark      = Remark;
            OrdersLog.Time        = DateTime.Now;

            #endregion
            Sys_OrdersManaage.TransactionAddOrders(Orders, OrdersDetailsList, OrdersLog);
            //return Redirect("/WxPay/Index?OrdersId=" + Orders.OrderId + "&PayTotal=" + Orders.SellingPrice);
            return(Json(new { OrdersId = Orders.OrderId, PayTotal = Orders.SellingPrice }, JsonRequestBehavior.AllowGet));
        }
Exemple #8
0
 public ActionResult AddByExcel(HttpPostedFileBase files)
 {
     try
     {
         files = Request.Files["file"];
         string path = Utility.ChangeText.SaveUploadPicture(files, "xls");
         Business.Sys_FlowerArrangement Sys_FlowerArrangement = new Business.Sys_FlowerArrangement();
         DataTable dt          = new DataTable();
         string    templetpath = Server.MapPath("~") + path;
         dt = Utility.Excel.ExcelToTable(templetpath);
         if (dt.Rows.Count <= 0)
         {
             Response.Write("<script>parent.layer.alert('导入失败!');</script>");
             return(View());
         }
         dt.Rows.RemoveAt(0);
         //公司
         Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin();
         List <Model.UserAdmin> UserAdminList = new List <Model.UserAdmin>();
         UserAdminList = Sys_UserAdmin.GetAdminInfoList("Customer");
         //花卉
         List <Model.Flower> FlowerList = new Business.Sys_Flower().GetFlowerList();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             Model.FlowerArrangement model = new Model.FlowerArrangement();
             model.arrangement    = dt.Rows[i][0].ToString();
             model.Specifications = Convert.ToDecimal(dt.Rows[i][1]).ToString();
             model.UnitPrice      = Convert.ToDecimal(dt.Rows[i][2]);
             model.Count          = Convert.ToInt32(dt.Rows[i][3].ToString());
             model.Total          = Convert.ToDecimal(dt.Rows[i][4].ToString());
             if (UserAdminList.Count(m => m.OwnedCompany == dt.Rows[i][5].ToString()) > 0)
             {
                 model.belongUsersId = UserAdminList.Where(m => m.OwnedCompany == dt.Rows[i][5].ToString()).ToList()[0].ID;
             }
             if (FlowerList.Count(n => n.FlowerWatchName == dt.Rows[i][6].ToString()) > 0)
             {
                 model.ShopId = FlowerList.Where(n => n.FlowerWatchName.Contains(dt.Rows[i][6].ToString())).ToList()[0].id;
             }
             model.Remark = dt.Rows[i][8].ToString();
             int id = Sys_FlowerArrangement.Add(model);
             Sys_FlowerArrangement.UpdateImgORCodePath(CreateORCode(id), id);
         }
         //删除上传的导入文件
         if (System.IO.File.Exists(templetpath))
         {
             System.IO.File.Delete(templetpath);
         }
         Response.Write("<script>parent.layer.alert('导入成功!');parent.layer.closeAll();</script>");
         return(View());
     }
     catch (Exception ex)
     {
         Utility.Log.WriteTextLog("导入Excel", "异常", ex.ToString(), "", "");
         Response.Write("<script>parent.layer.alert('表格格式或数据有误!');</script>");
         return(View());
     }
 }
Exemple #9
0
        public ActionResult CheckFlowerWatchName()
        {
            string FlowerWatchName = Request["FlowerWatchName"]; Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();

            if (Sys_Flower.CheckFlowerWatchName(FlowerWatchName))
            {
                return(Content("True"));
            }
            return(Content("False"));
        }
Exemple #10
0
        public ActionResult CheckFlowerNumber()
        {
            string FlowerNumber = Request["FlowerNumber"];

            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            if (Sys_Flower.CheckFlowerNumber(FlowerNumber))
            {
                return(Content("True"));
            }
            return(Content("False"));
        }
Exemple #11
0
        public ActionResult Delete()
        {
            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            string id = Request["id"];

            Model.Flower Flower = Sys_Flower.GetFlower(id);
            if (Sys_Flower.DeleteFlowerWatch(id))
            {
                DeleteFlowerPhoto(Flower.FlowerWatchPhoto);
                return(Content("True"));
            }
            return(Content("Fasle"));
        }
Exemple #12
0
        /// <summary>
        /// 花卉记录更多
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMobleFlowerMore()
        {
            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            StringBuilder       sb         = new StringBuilder();
            int page = int.Parse(Request["page"]);

            if (page > 1)
            {
                page = (page - 1) * 10 + 1;//按偏移量
            }
            List <Model.Flower> List = Sys_Flower.GetFlowerList(10, Convert.ToInt32(page), sb.ToString());

            return(Json(List, JsonRequestBehavior.AllowGet));
        }
Exemple #13
0
        /// <summary>
        /// 分页获得数据信息
        /// </summary>
        /// <param name="limit">页码大小</param>
        /// <returns></returns>
        public ActionResult GetList(int limit)
        {
            int    offset          = Convert.ToInt32(Request["offset"]);
            string FlowerWatchName = Request["FlowerWatchName"];

            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            StringBuilder       sb         = new StringBuilder();

            if (!string.IsNullOrEmpty(FlowerWatchName))
            {
                sb.Append(" and FlowerWatchName like'%" + FlowerWatchName + "%'");
            }
            return(Json(new { total = Sys_Flower.GetFlowerListCount(sb.ToString()), rows = Sys_Flower.GetFlowerList(limit, offset, sb.ToString()) }, JsonRequestBehavior.AllowGet));
        }
Exemple #14
0
 public ActionResult AddByExcel(HttpPostedFileBase files)
 {
     try
     {
         files = Request.Files["file"];
         string path = Utility.ChangeText.SaveUploadPicture(files, "xlt");
         Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
         DataTable           dt         = new DataTable();
         string templetpath             = Server.MapPath("~") + path;
         dt = Utility.Excel.ExcelToTable(templetpath);
         if (dt.Rows.Count <= 0)
         {
             Response.Write("<script>parent.layer.alert('导入失败!');</script>");
             return(View());
         }
         dt.Rows.RemoveAt(0);
         List <Model.Flower> list = Sys_Flower.GetFlowerList();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             Model.Flower model = new Model.Flower();
             model.FlowerNumber = GetFlowerNum();
             var fname = dt.Rows[i][0].ToString();//检查名称重复
             if (list.Count(m => m.FlowerWatchName.Contains(fname)) < 1)
             {
                 model.FlowerWatchName = fname;
             }
             model.FlowerWatchType    = dt.Rows[i][1].ToString();
             model.FlowerStock        = Convert.ToInt32(dt.Rows[i][2].ToString());
             model.FlowerCostPrice    = Convert.ToInt32(dt.Rows[i][3].ToString());
             model.FlowerSalesPrice   = Convert.ToDecimal(dt.Rows[i][4].ToString());
             model.FlowerIntroduction = dt.Rows[i][5].ToString();
             model.XiXin        = dt.Rows[i][6].ToString();
             model.YangHuFangFa = dt.Rows[i][7].ToString();
             Sys_Flower.InsertFlowerWatch(model);
         }
         //删除上传的导入文件
         if (System.IO.File.Exists(templetpath))
         {
             System.IO.File.Delete(templetpath);
         }
         Response.Write("<script>parent.layer.alert('导入成功!');parent.layer.closeAll();</script>");
         return(View());
     }
     catch (Exception ex)
     {
         Utility.Log.WriteTextLog("导入Excel", "异常", ex.ToString(), "", "");
         Response.Write("<script>parent.layer.alert('表格格式或数据有误!');</script>");
         return(View());
     }
 }
Exemple #15
0
        public ActionResult Add(Model.Flower Flower)
        {
            HttpPostedFileBase file = Request.Files["attach_path"];

            Flower.FlowerNumber     = GetFlowerNum();
            Flower.FlowerWatchPhoto = Utility.ChangeText.SaveUploadPicture(file, "FlowerPhoto");
            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            //ViewData["success"] = "添加失败";
            if (Sys_Flower.InsertFlowerWatch(Flower))
            {
                //ViewData["success"] = "添加成功";
            }
            Response.Write("<script>parent.layer.closeAll();</script>");
            return(View());
        }
        /// <summary>
        /// 获得花卉列表
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public JsonResult GetFlowerList(string key)
        {
            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            List <Model.Flower> FlowerList = Sys_Flower.GetFlowerList();
            var flolist = FlowerList.Where(x => x.FlowerWatchName.Contains(key)).ToList().Take(5);
            List <SelectListItem> hourList = new List <SelectListItem>();

            foreach (var item in flolist)
            {
                hourList.Add(new SelectListItem {
                    Text = item.FlowerWatchName, Value = item.id.ToString()
                });
            }
            return(Json(hourList, JsonRequestBehavior.AllowGet));
        }
Exemple #17
0
        public ActionResult CreateOrders()
        {
            string GoodsId = Request["GoodsId"];

            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            Model.Flower        Flower     = Sys_Flower.GetFlowerByFlowerNumber(GoodsId);
            //判断库存是否足够商品
            if (Flower.FlowerStock < Convert.ToInt32(Request["FlowerStock"]))
            {
                ViewData["success"] = "抱歉,库存不足";
                return(View());
            }
            Model.Orders Orders = new Model.Orders();
            Orders.OrderId          = Utility.ChangeText.GenerateOutTradeNo();
            Orders.OrdersState      = 1;
            Orders.SellingPrice     = Flower.FlowerSalesPrice * Convert.ToInt32(Request["FlowerStock"]);
            Orders.CostPrice        = Flower.FlowerCostPrice * Convert.ToInt32(Request["FlowerStock"]);
            Orders.ConsigneAaddress = Request["ConsigneAaddress"];
            Orders.ConsigneeName    = Request["ConsigneeName"];
            Orders.GoodsSum         = Convert.ToInt32(Request["FlowerStock"]);
            Orders.ConsigneePhone   = Request["ConsigneePhone"];
            List <Model.OrdersDetails> OrdersDetailsList = new List <Model.OrdersDetails> ();

            for (int i = 0; i < Convert.ToInt32(Request["FlowerStock"]); i++)
            {
                Model.OrdersDetails OrdersDetails = new Model.OrdersDetails();
                OrdersDetails.OrderId          = Orders.OrderId;
                OrdersDetails.SellingPrice     = Flower.FlowerSalesPrice;
                OrdersDetails.FlowerNumber     = Flower.FlowerNumber;
                OrdersDetails.CostPrice        = Flower.FlowerCostPrice;
                OrdersDetails.FlowerWatchPhoto = Flower.FlowerWatchPhoto;
                OrdersDetails.SellingNum       = 1;
                OrdersDetails.FlowerWatchName  = Flower.FlowerWatchName;
                OrdersDetailsList.Add(OrdersDetails);
            }
            Model.OrdersLog OrdersLog = new Model.OrdersLog();
            OrdersLog.OrdersId    = Orders.OrderId;
            OrdersLog.OrdersState = 1;
            OrdersLog.UserName    = Utility.ChangeText.GetUserName();
            Business.Sys_OrdersManaage Sys_OrdersManaage = new Business.Sys_OrdersManaage();
            if (!Sys_OrdersManaage.InsertOrders(Orders, OrdersDetailsList, OrdersLog))
            {
                ViewData["success"] = "下单失败,请联系管理员";
                return(View());
            }
            return(RedirectToAction("", ""));
        }
Exemple #18
0
        public ActionResult ShowPhoto()
        {
            string table = Request["table"];
            string id    = Request["id"];

            if (table == "Flower")
            {
                Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
                ViewData["url"] = Sys_Flower.GetFlower(id).FlowerWatchPhoto;
            }
            if (table == "ProblemsAndSuggestions")
            {
                Business.Sys_ProblemsAndSuggestions Sys_ProblemsAndSuggestions = new Business.Sys_ProblemsAndSuggestions();
                ViewData["url"] = Sys_ProblemsAndSuggestions.GetModelById(id).PhotoList;
            }
            return(View());
        }
Exemple #19
0
        public List <SelectListItem> GetdeptSelectItems()
        {
            Business.Sys_Flower   Sys_Flower      = new Business.Sys_Flower();
            List <Model.Flower>   FlowerList      = Sys_Flower.GetFlowerList();
            List <SelectListItem> deptSelectItems = new List <SelectListItem>();
            SelectListItem        items           = new SelectListItem();

            items.Text     = "--请选择--";
            items.Value    = "";
            items.Selected = true;
            deptSelectItems.Add(items);
            foreach (Model.Flower d in FlowerList)
            {
                SelectListItem item = new SelectListItem();
                item.Text     = d.FlowerWatchName;
                item.Value    = d.id.ToString();
                item.Selected = false;
                deptSelectItems.Add(item);
            }
            return(deptSelectItems);
        }
Exemple #20
0
        public List <SelectListItem> GetShopList(int ShopId = 0)
        {
            Business.Sys_Flower   Sys_Flower = new Business.Sys_Flower();
            List <Model.Flower>   FlowerList = Sys_Flower.GetFlowerList();
            List <SelectListItem> hourList   = new List <SelectListItem>();

            foreach (var item in FlowerList)
            {
                if (ShopId != 0)
                {
                    if (item.id == ShopId)
                    {
                        hourList.Add(new SelectListItem {
                            Text = item.FlowerWatchName + "(" + item.FlowerWatchType + ")", Value = item.id.ToString(), Selected = true
                        });
                        continue;
                    }
                }
                hourList.Add(new SelectListItem {
                    Text = item.FlowerWatchName + "(" + item.FlowerWatchType + ")", Value = item.id.ToString()
                });
            }
            return(hourList);
        }
Exemple #21
0
        //
        // GET: /Shop/
        public ActionResult Index()
        {
            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();

            return(View(Sys_Flower.GetFlowerList()));
        }
Exemple #22
0
        public ActionResult PayOrders(string id)
        {
            #region 生成订单
            ////string id = Request["id"];
            //Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            //Model.Flower Flower = Sys_Flower.GetFlower(id);
            //string FlowerNum = Request["FlowerNum"];
            //string address = Request["province"] + Request["city"] + Request["area"] + Request["ConsigneAaddress"];
            //string ConsigneeName = Request["ConsigneeName"];
            //string ConsigneePhone = Request["ConsigneePhone"];
            //Model.Orders Orders = new Model.Orders();
            //Orders.UsersId = Utility.ChangeText.GetUsersId();
            //Orders.CreateTime = DateTime.Now;
            //Orders.SellingPrice = Flower.FlowerSalesPrice * int.Parse(FlowerNum);
            //Orders.OrdersState = 1;
            //Orders.OrderId = Utility.ChangeText.OrderIdCreate();
            //Orders.GoodsSum = int.Parse(FlowerNum);
            //Orders.CostPrice = Flower.FlowerCostPrice * int.Parse(FlowerNum);
            //Orders.ConsigneeName = ConsigneeName;
            //Orders.ConsigneePhone = ConsigneePhone;
            //Orders.ConsigneAaddress = address;
            //List<Model.OrdersDetails> OrdersDetailsList = new List<Model.OrdersDetails>();
            //for (int i = 0; i < int.Parse(FlowerNum); i++)
            //{
            //    Model.OrdersDetails OrdersDetails = new Model.OrdersDetails();
            //    OrdersDetails.OrderId = Orders.OrderId;
            //    OrdersDetails.FlowerNumber = Flower.FlowerNumber;
            //    OrdersDetails.FlowerWatchName = Flower.FlowerWatchName;
            //    OrdersDetails.FlowerWatchPhoto = Flower.FlowerWatchPhoto;
            //    OrdersDetails.SellingPrice = Flower.FlowerSalesPrice;
            //    OrdersDetails.SellingNum = 1;//从原来的FlowerNum修改成1
            //    OrdersDetails.CostPrice = Flower.FlowerCostPrice;
            //    OrdersDetailsList.Add(OrdersDetails);
            //}
            //Model.OrdersLog OrdersLog = new Model.OrdersLog();
            //OrdersLog.OrdersId = Orders.OrderId;
            //OrdersLog.OrdersState = 1;
            //OrdersLog.UserName = Utility.ChangeText.GetUserName();
            //OrdersLog.Remark = "商品详情页中下单";
            //OrdersLog.Time = DateTime.Now;

            //Business.Sys_OrdersManaage Sys_OrdersManaage = new Business.Sys_OrdersManaage();
            //Sys_OrdersManaage.InsertOrders(Orders, OrdersDetailsList, OrdersLog);
            #endregion
            ViewData["ids"] = id;
            ViewData["msg"] = " 提示:请在30分钟内完成在线支付,逾期将视为订单无效";
            Business.Sys_Flower Sys_Flower = new Business.Sys_Flower();
            Model.Flower        flower     = Sys_Flower.GetFlower(id);
            Model.FlowerCartVM  fc         = new Model.FlowerCartVM();
            fc.Id               = 0;
            fc.FlowerId         = flower.id.ToString();
            fc.Num              = int.Parse(Request["FlowerNum"]);
            fc.FlowerSalesPrice = flower.FlowerSalesPrice;
            fc.FlowerWatchPhoto = flower.FlowerWatchPhoto;
            fc.FlowerWatchName  = flower.FlowerWatchName;
            List <Model.FlowerCartVM> list = new List <Model.FlowerCartVM> {
                fc
            };
            Model.CartLine model = new Model.CartLine();
            model.Products = list;
            return(View(model));
        }