Beispiel #1
0
        public ActionResult Brand_add3(int Id = 0)
        {
            ShopBrand openshop = new ShopBrand();

            openshop.Id = Id;
            return(View(openshop));
        }
Beispiel #2
0
        public ActionResult Company_infoimg(ShopBrand moudel)
        {
            string viewname     = "";
            var    fileLogoName = UploadImgUtility.UploadImage(Request.Files["Logofile"], Server.MapPath(CommonContorllers.FileUploadBrandLogoImgPath));

            if (!string.IsNullOrEmpty(fileLogoName))
            {
                moudel.Logo = CommonContorllers.FileUploadBrandLogoImgPath + fileLogoName;
                viewname    = "Company_info";
            }
            var fileQRcodeName = UploadImgUtility.UploadImage(Request.Files["QRcodefile"], Server.MapPath(CommonContorllers.FileUploadBrandQRCodeImgPath));

            if (!string.IsNullOrEmpty(fileQRcodeName))
            {
                moudel.QRCode = CommonContorllers.FileUploadBrandQRCodeImgPath + fileQRcodeName;
                viewname      = "Company_info";
            }

            var fileBLSName = UploadImgUtility.UploadImage(Request.Files["BLSfile"], Server.MapPath(CommonContorllers.FileUploadBrandBLSImgPath));

            if (!string.IsNullOrEmpty(fileBLSName))
            {
                moudel.BLS = CommonContorllers.FileUploadBrandBLSImgPath + fileBLSName;
                viewname   = "Company_Qualifications";
            }
            var fileCICName = UploadImgUtility.UploadImage(Request.Files["CICfile"], Server.MapPath(CommonContorllers.FileUploadBrandCICImgPath));

            if (!string.IsNullOrEmpty(fileCICName))
            {
                moudel.CIC = CommonContorllers.FileUploadBrandCICImgPath + fileCICName;
                viewname   = "Company_Qualifications";
            }
            return(View(viewname, moudel));
        }
Beispiel #3
0
        public ActionResult Save(ShopBrand entity)
        {
            var json = new JsonHelp();

            try
            {
                if (entity.ID == 0)
                {
                    json.IsSuccess = DB.ShopBrand.Insert(entity);
                    json.Msg       = "添加";
                }
                else
                {
                    json.IsSuccess = DB.ShopBrand.Update(entity);
                    json.Msg       = "修改";
                }
                if (json.IsSuccess)
                {
                    json.ReUrl = ControllerPath + "/Index";   //注册成功就跳转到 激活页
                    json.Msg  += "成功";
                }
                else
                {
                    json.Msg += "失败";
                }
            }
            catch (Exception e)
            {
                json.IsSuccess = false;
                json.Msg       = "操作失败";
                LogHelper.Error("保存品牌失败:" + WebTools.getFinalException(e));
            }
            return(Json(json));
        }
Beispiel #4
0
        public APIResult Add([FromBody] AddArgsModel args)
        {
            if (string.IsNullOrEmpty(args.Name))
            {
                throw new ArgumentNullException("Name");
            }
            if (string.IsNullOrEmpty(args.Flag))
            {
                args.Flag = System.Guid.NewGuid().ToString();
            }
            if (!args.Status.HasValue)
            {
                args.Status = ShopBrandStatus.正常;
            }

            var model = new ShopBrand()
            {
                Flag    = args.Flag,
                AddIp   = GetIp(),
                AddTime = DateTime.Now,
                AddUser = GetUsername(),
                Address = args.Address,
                Name    = args.Name,
                Status  = args.Status.Value,
                Detail  = args.Detail
            };

            db.Add <ShopBrand>(model);
            db.SaveChanges();

            return(Success());
        }
Beispiel #5
0
        public ActionResult Brand_add1()
        {
            ShopBrand moudel     = new ShopBrand();
            var       attrsTypes = this._iShopAttributesServiceService.GetListByAttributeId(9);

            ViewBag.shopType = attrsTypes;
            return(View(moudel));
        }
Beispiel #6
0
 public ActionResult Brand_add3UPdate(ShopBrand openshop)
 {
     DataAccess.ShopBrand moudel = this._shopBrandService.GetById(openshop.Id);
     moudel.Id  = openshop.Id;
     moudel.BLS = openshop.BLS;
     moudel.CIC = openshop.CIC;
     this._shopBrandService.Update(moudel);
     return(RedirectToAction("Brand_add4"));
 }
Beispiel #7
0
        public ActionResult Company_QualificationsUPdate(ShopBrand Brand)
        {
            ShopBrand moudel = this._shopBrandService.GetById(Brand.Id);

            moudel.Id  = Brand.Id;
            moudel.BLS = Brand.BLS;
            moudel.CIC = Brand.CIC;
            this._shopBrandService.Update(moudel);
            return(RedirectToAction("Company_Qualifications/" + moudel.Id));
        }
        /// <summary>
        /// 品牌。
        /// </summary>
        /// <returns></returns>
        public ActionResult Brand()
        {
            ShopBrand entity = null;
            bool      isMember;
            bool      isBrand;
            Customer  member = GetCurrentUser(out isMember, out isBrand);

            if (member == null || !isMember)//只有已登录的会员用户才可以管理自己的品牌。
            {
                return(RedirectToAction("Index", "Login"));
            }
            if (isBrand)
            {
                entity = _IShopBrandService.GetById(member.Companyid);
            }
            Brand b = new Brand();

            if (entity != null)
            {
                b.Id          = entity.Id;
                b.Name        = entity.Name;
                b.Logo        = Path.Combine(CDN_DOMAIN, CommonContorllers.FileUploadBrandLogoImgPath, entity.Logo);
                b.QRCode      = Path.Combine(CDN_DOMAIN, CommonContorllers.FileUploadBrandQRCodeImgPath, entity.QRCode);
                b.WebUrl      = entity.Url;
                b.VideoUrl    = entity.VidoUrl;
                b.IsAllowJoin = entity.JoinIn.HasValue ? entity.JoinIn.Value : false;
                b.IsValid     = entity.Recsts != 0;
                b.Introduce   = entity.Abbreviation;
                b.ShopBrandAttributeValues = entity.ShopBrandAttributeValues;
            }
            ViewBag.FunctionName = isBrand ? "修改品牌" : "品牌申请";

            //#region 业态使用的扩展控件需要先定义选项。

            //List<ShopAttributeValues> list = _iShopAttributesServiceService.GetListByAttributeId(9);//业态。
            //List<CodeDescription> codes = new List<CodeDescription>();
            //if (list != null)
            //{
            //    foreach (ShopAttributeValues item in list)
            //    {
            //        codes.Add(new CodeDescription(item.Id.ToString(), item.ValueStr, "业态"));
            //    }
            //}
            //CodeManager.codes = codes.ToArray();

            //#endregion

            ViewBag.AttriButes = this._iShopAttributesServiceService.GetListByAttributeId(9);

            return(View(b));
        }
Beispiel #9
0
        public ActionResult Detail(int?id)
        {
            ShopBrand entity = null;

            ViewBag.List = DB.ShopProductCategory.Where(a => a.Layer == 1).OrderBy(a => a.ID).Select(a => new { a.ID, a.Name })
                           .ToList().Select(a => new KeyValuePair <int, string>(a.ID, a.Name)).ToList();
            if (id == null)
            {
                entity = new ShopBrand();
            }
            else
            {
                entity = DB.ShopBrand.FindEntity(id);
            }

            return(View(entity));
        }
Beispiel #10
0
        public ActionResult uploadimg(ShopBrand moudel)
        {
            string viewname = "";

            if (moudel.Id != 0)
            {
                viewname = "Brand_add3";
                var fileBLSName = UploadImgUtility.UploadImage(Request.Files["BLSfile"], Server.MapPath(CommonContorllers.FileUploadBrandBLSImgPath));
                if (!string.IsNullOrEmpty(fileBLSName))
                {
                    moudel.BLS = CommonContorllers.FileUploadBrandBLSImgPath + fileBLSName;
                }
                var fileCICName = UploadImgUtility.UploadImage(Request.Files["CICfile"], Server.MapPath(CommonContorllers.FileUploadBrandCICImgPath));
                if (!string.IsNullOrEmpty(fileCICName))
                {
                    moudel.CIC = CommonContorllers.FileUploadBrandCICImgPath + fileCICName;
                }
            }
            else
            {
                YG.SC.DataAccess.ShopBrand model = new DataAccess.ShopBrand();
                var attrsTypes = this._iShopAttributesServiceService.GetListByAttributeId(9);
                ViewBag.shopType = attrsTypes;

                var fileLogoName = UploadImgUtility.UploadImage(Request.Files["Logofile"], Server.MapPath(CommonContorllers.FileUploadBrandLogoImgPath));
                if (!string.IsNullOrEmpty(fileLogoName))
                {
                    moudel.Logo = CommonContorllers.FileUploadBrandLogoImgPath + fileLogoName;
                }
                var fileQRcodeName = UploadImgUtility.UploadImage(Request.Files["QRcodefile"], Server.MapPath(CommonContorllers.FileUploadBrandQRCodeImgPath));
                if (!string.IsNullOrEmpty(fileQRcodeName))
                {
                    moudel.QRCode = CommonContorllers.FileUploadBrandQRCodeImgPath + fileQRcodeName;
                }
                ViewBag.attributesvalue = Request["selAttribute"];
                viewname = "Brand_add1";
            }
            return(View(viewname, moudel));
        }
        public ActionResult BrandEdit(Brand model)
        {
            bool     isMember;
            bool     isBrand;
            Customer member = GetCurrentUser(out isMember, out isBrand);

            if (member == null || !isMember)//只有已登录的会员用户才可以管理自己的品牌。
            {
                return(RedirectToAction("Index", "Login"));
            }
            var       fileLogoName   = UploadImgUtility.UploadImage(Request.Files["Logo"], Server.MapPath(CommonContorllers.FileUploadBrandLogoImgPath));
            var       fileQRCodeName = UploadImgUtility.UploadImage(Request.Files["QRCode"], Server.MapPath(CommonContorllers.FileUploadBrandQRCodeImgPath));
            ShopBrand sb             = new ShopBrand();

            if (isBrand)
            {
                sb = _IShopBrandService.GetById(member.Companyid);
            }
            sb.Name = model.Name;
            if (!string.IsNullOrEmpty(fileLogoName))
            {
                sb.Logo = fileLogoName;
            }
            if (!string.IsNullOrEmpty(fileQRCodeName))
            {
                sb.QRCode = fileQRCodeName;
            }
            sb.Url          = model.WebUrl;
            sb.VidoUrl      = model.VideoUrl;
            sb.JoinIn       = model.IsAllowJoin;
            sb.Recsts       = model.IsValid ? 1 : 0;
            sb.Abbreviation = model.Introduce;
            if (isBrand)
            {
                sb.Id = member.Companyid;
                _IShopBrandService.Update(sb);
            }
            else
            {
                _IShopBrandService.Insert(sb);
                Customer c = _iCustomerService.GetEntityById(UserContext.Current.Id);
                c.Companyid = sb.Id;
                _iCustomerService.Update(c);
            }
            //增加业态
            List <ShopBrandAttributeValues> listattr = new List <ShopBrandAttributeValues>();
            var attributesvalue = Request["selAttribute"];

            if (!string.IsNullOrEmpty(attributesvalue))
            {
                foreach (var item in attributesvalue.Split(','))
                {
                    ShopBrandAttributeValues bv = new ShopBrandAttributeValues()
                    {
                        BrandId           = sb.Id,
                        Recsts            = 1,
                        AttributesId      = Convert.ToInt32(item.Split('-')[0]),
                        AttributeValuesId = Convert.ToInt32(item.Split('-')[1]),
                    };
                    listattr.Add(bv);
                }
            }
            this._iShopAttributesServiceService.InsertList(listattr);
            return(RedirectToAction("Brand"));
        }
Beispiel #12
0
        public ActionResult Company_Qualifications(int Id = 0)
        {
            ShopBrand openshop = this._shopBrandService.GetById(Id);

            return(View(openshop));
        }
Beispiel #13
0
 /// <summary>
 /// 产品首页,指定品牌
 /// </summary>
 /// <returns></returns>
 public static string GetProduct(ShopBrand model)
 {
     return(GetController("product") + "?brandid=" + model.ID);
 }
Beispiel #14
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="model">实体类</param>
 /// <param name="whereString">可选,更新条件</param>
 /// <returns></returns>
 public bool Update(ShopBrand model, string whereString = null)
 {
     return(CreateDao().Update(model, whereString));
 }
Beispiel #15
0
 /// <summary>
 /// 新增数据,并返回自增ID
 /// </summary>
 /// <param name="model">实体类</param>
 /// <returns></returns>
 public int InsertIdentity(ShopBrand model)
 {
     return(CreateDao().InsertIdentity(model));
 }
Beispiel #16
0
 /// <summary>
 /// 新增数据
 /// </summary>
 /// <param name="model">实体类</param>
 /// <returns></returns>
 public bool Insert(ShopBrand model)
 {
     return(CreateDao().Insert(model));
 }