/// <summary> /// 操作最新上架 /// </summary> /// <param name="model"></param> /// <returns></returns> public int OperationNewShelf(SwfsFlagShipNewArrival model, int NewArrivalId, string UserId) { //判断ID如果为空,那就是添加 if (NewArrivalId == 0) { model.OperateUserId = UserId; model.NewArrivalTitle = "新品上架"; model.PageNo = "index"; model.PagePositionNo = "top"; model.PagePositionName = "新品上架"; model.CreateDate = System.DateTime.Now; model.SortValue = 0; model.Status = 1; model.DataState = 1; model.UpdateDate = System.DateTime.Now; return(DapperUtil.Insert <SwfsFlagShipNewArrival>(model)); } else//否则就是修改 { model.UpdateDate = System.DateTime.Now; model.NewArrivalId = NewArrivalId; string str = "update SwfsFlagShipNewArrival set NewShelfDate='" + model.NewShelfDate + "',UpdateOperateUserId='" + model.UpdateOperateUserId + "',UpdateDate='" + model.UpdateDate + "' where NewArrivalId=" + model.NewArrivalId; Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("sqlstring", str); return(DapperUtil.Query <int>("ComBeziWfs_SwfsFlagShipNewArrivalProductList_InsertsProduct", dic).FirstOrDefault()); } }
/// <summary> /// 添加最新预报列表 /// </summary> /// <param name="NewArrivalNoticeDTO"></param> /// <returns></returns> public int AddNewArrivalNotice(SWfsNewArrivalNotice NewArrivalNoticeDTO) { int result = 0; result = DapperUtil.Insert <SWfsNewArrivalNotice>(NewArrivalNoticeDTO); return(result); }
//保存结构的子类 public int SaveStructChild(IEnumerable <SWfsProductRefTemplate> region, int parentId) { if (parentId == 0) { return(0); } for (int i = 0; i < region.Count(); i++) { region.ElementAt(i).ParentId = parentId; if (region.ElementAt(i).TemplateHtmlCode == null || region.ElementAt(i).ModuleStatus == 0) { region.ElementAt(i).TemplateHtmlCode = ""; } if (region.ElementAt(i).TemplateHtmlCodeMobile == null || region.ElementAt(i).ModuleStatus == 0) { region.ElementAt(i).TemplateHtmlCodeMobile = ""; } if (region.ElementAt(i).ProductNo == null) { region.ElementAt(i).ProductNo = ""; } DapperUtil.Insert <SWfsProductRefTemplate>(region.ElementAt(i), true); } return(1); }
//修改旗舰店 public int EditeMobileFlagShipStoreByID(SWfsBrandFlagShipStoreMobile obj) { if (obj.BrandNO == null) { return(0); } if (obj.HtmlCode == null) { obj.HtmlCode = ""; } if (obj.TemplateNo == null) { obj.TemplateNo = ""; } obj.CreateDate = DateTime.Now; if (obj.FlagShipSotreID == 0) { if (GetMobileFlagShipStoreObjByBrandNO(obj.BrandNO) != null)//判断是否存在 { return(-1); } return(DapperUtil.Insert <SWfsBrandFlagShipStoreMobile>(obj, true)); } else { return(DapperUtil.Update <SWfsBrandFlagShipStoreMobile>(obj) ? 1 : 0); } }
/// <summary> /// 配置上新时间设置方法 /// </summary> /// <param name="model"></param> /// <returns></returns> public int ConfigNewDate(SwfsFlagShipGloalConfig model) { SwfsFlagShipGloalConfig Config = this.NewDateManageBrandNo(model.BrandNo); if (Config == null)//如果为空就是添加数据 { try { model.DataCreate = System.DateTime.Now; DapperUtil.Insert <SwfsFlagShipGloalConfig>(model); return(1); } catch (Exception) { return(0); throw; } } else //修改操作 { Config.ConfigName = model.ConfigName; Config.ConfigValue = model.ConfigValue; Config.ConfigTime = model.ConfigTime; return(DapperUtil.Update <SwfsFlagShipGloalConfig>(Config) == true ? 1 : 0); } }
//添加商品编辑块内容 public int AddProductRefContent(SWfsProductRef obj) { if (obj.ProductNO == null) { return(0); } obj.CreateDate = DateTime.Now; obj.EditeDate = DateTime.Now; Passport passport = PresentationHelper.GetPassport(); obj.PublishTime = DateTime.Now; obj.EditePeople = (passport != null ? passport.UserName : ""); obj.PublishPeople = ""; obj.ProductTitle = ""; obj.TemplateNO = ""; obj.PublishHTML = ""; if (obj.HTMLCode == null) { obj.HTMLCode = ""; } if (obj.HTMLCodeMobile == null) { obj.HTMLCodeMobile = ""; } return(DapperUtil.Insert <SWfsProductRef>(obj, true)); }
//保存商品的title public int SaveProductTitle(string productNo, string productTitle) { //判断是否存在编辑过的商品 SWfsProductRef productObj = GetProductRefByProductNO(productNo); if (productObj == null) { productObj.ProductNO = productNo; productObj.TemplateNO = ""; productObj.CreateDate = DateTime.Parse("1900-01-01 00:00:00"); productObj.EditeDate = DateTime.Parse("1900-01-01 00:00:00"); productObj.HTMLCode = ""; productObj.PublishHTML = ""; productObj.ProductTitle = productTitle; productObj.PublishTime = DateTime.Parse("1900-01-01 00:00:00"); productObj.PublishPeople = ""; productObj.EditePeople = ""; productObj.HTMLCodeMobile = ""; productObj.PublishHTMLMobile = ""; return(DapperUtil.Insert <SWfsProductRef>(productObj)); } else { return(DapperUtil.UpdatePartialColumns <SWfsProductRef>(new { RefID = productObj.RefID, ProductTitle = productTitle })?1:0); } return(DapperUtil.Execute("ComBeziWfs_SWfsProductRef_SaveProductTitle", new { ProductTitle = productTitle, ProductNO = productNo })); }
/// <summary> /// 插入Ocs分类 /// </summary> /// <param name="SDto"></param> /// <returns></returns> public int AddOcsCategory(SWfsSortOcsCategory SDto) { int result = 0; result = DapperUtil.Insert <SWfsSortOcsCategory>(SDto, true); return(result); }
/// <summary> /// 插入产品 /// </summary> /// <param name="ProductInfo"></param> /// <returns></returns> public int AddProductToSortSingle(SWfsSortProduct productInfo) { int result = 0; result = DapperUtil.Insert <SWfsSortProduct>(productInfo, true); return(result); }
/// <summary> /// 用于频道页逻辑 /// </summary> /// <param name="recommendBrand"></param> /// <returns></returns> public int InsertSWfsSpChannelRecommendBrandChannel(SWfsSpHomeRecommendBrand recommendBrand) { if (UpdateSWfsSpChannelRecommendBrandChannel(recommendBrand, PresentationHelper.GetPassport().UserName)) { return(DapperUtil.Insert <SWfsSpHomeRecommendBrand>(recommendBrand, true)); } return(-1); }
//增加旗舰店信息 public int InsertFlagShipStore(SWfsBrandFlagShipStoreSave obj) { if (DapperUtil.Query <int>("ComBeziWfs_SWfsBrandSpecialityStore_IsExistFlagBrandNo", new { BrandNo = obj.BrandNo }).FirstOrDefault() > 0) { return(1); } return(DapperUtil.Insert <SWfsBrandFlagShipStoreSave>(obj, true)); }
//插入新的咨询关联 public int InsertSWfsQuestAnswerRef(SWfsQuestAnswerRef QAR) { if (UpdateSWfsQuestAnswerOperateUserId(QAR.QuestAnswerId, PresentationHelper.GetPassport().UserName)) { return(DapperUtil.Insert <SWfsQuestAnswerRef>(QAR, false)); } return(-1); }
//保存区块关联 public bool SaveRegionRelationInfo(SWfsBrandFlagShipStoreRegion obj) { if (obj.RegionID <= 0 || obj.BrandNO == null || obj.RelationType <= 0 || string.IsNullOrEmpty(obj.TemplateNo)) { return(false); } if (obj.ImgNO == null) { obj.ImgNO = ""; } if (obj.RelationContent == null) { obj.RelationContent = ""; } obj.CreateDate = DateTime.Now; //查询关联数据描述 switch (obj.RelationType) { case 1: //查询名称活动 if (!string.IsNullOrEmpty(obj.RelationContent)) { SWfsNewSubject subobj = GetNewSubjectByNO(obj.RelationContent); obj.Direction = subobj == null ? "" : subobj.SubjectName; } break; case 2: obj.Direction = ""; break; case 3: if (!string.IsNullOrEmpty(obj.RelationContent)) { SWfsBrandNavigation navobj = GetBrandNavigationNO(obj.RelationContent); obj.Direction = navobj == null ? "" : navobj.NavigationName; } break; case 4: obj.Direction = ""; break; } if (obj.FlagReigionID == 0) { //判断是否已近存在该区块的数据 if (GetRegionRelationInfoByCondition(obj.BrandNO, obj.TemplateNo, obj.RegionID).Count() > 0) { return(false); } return(DapperUtil.Insert <SWfsBrandFlagShipStoreRegion>(obj, true) > 0 ? true : false); } else { return(DapperUtil.Update <SWfsBrandFlagShipStoreRegion>(obj)); } }
/// <summary> /// 添加首页推荐品牌 /// </summary> /// <param name="channelNo">A01或者A02区分男女</param> /// <param name="brandNo">品牌编号</param> /// <returns></returns> public int AddHomeBrand(string channelNo, string brandNo) { return(DapperUtil.Insert <SWfsSpHomeRecommendBrand>(new SWfsSpHomeRecommendBrand { PageNo = channelNo, BrandNO = brandNo, SortId = 999, CreateDate = DateTime.Now }, true)); }
/// <summary> /// 创建品牌索引 /// </summary> /// <param name="brandIndex"></param> /// <returns></returns> public int SaveBrandIndex(SWfsBrandIndex brandIndex) { if (brandIndex != null && brandIndex.IndexId == 0) { return(DapperUtil.Insert <SWfsBrandIndex>(brandIndex)); } else { return(DapperUtil.Update <SWfsBrandIndex>(brandIndex) ? 1 : -1); } }
/// <summary> /// 保存或更新楼层 /// </summary> /// <param name="model"></param> /// <returns></returns> public SwfsFlagShipModule InsertOrUpdateSwfsFlagShipModule(SwfsFlagShipModule model) { if (model.ModuleId == 0) { model.ModuleId = DapperUtil.Insert <SwfsFlagShipModule>(model, true); } else { DapperUtil.Update <SwfsFlagShipModule>(model); } return(model); }
//添加历史记录 public int AddSearchHistory(SWfsProductLabelSearchHistory obj) { Passport passport = PresentationHelper.GetPassport(); if (passport != null && !string.IsNullOrEmpty(passport.UserName)) { obj.CreateDate = DateTime.Now; obj.SearchUser = passport.UserName; return(DapperUtil.Insert <SWfsProductLabelSearchHistory>(obj, true)); } return(0); }
/// <summary> /// 保存或更新楼层内容 /// </summary> /// <param name="model"></param> /// <returns></returns> public SwfsFlagShipModuleLink InsertOrUpdateSwfsFlagShipModuleLink(SwfsFlagShipModuleLink model) { if (model.LinkId == 0) { model.LinkId = DapperUtil.Insert <SwfsFlagShipModuleLink>(model, true); } else { DapperUtil.Update <SwfsFlagShipModuleLink>(model); } return(model); }
/// <summary> /// 读取配置值 /// </summary> /// <param name="functionNo">功能编号,固定</param> /// <param name="configValue">配置值</param> /// <returns></returns> public SwfsFlagShipGloalConfig InsertOrUpdateSwfsFlagShipGloalConfig(SwfsFlagShipGloalConfig config) { if (config.ConfigId > 0) { DapperUtil.Update(config); } else { config.ConfigId = DapperUtil.Insert(config, true); } return(config); }
/// <summary> /// 更新或插入广告图 /// </summary> /// <param name="model"></param> /// <returns></returns> public SWfsOperationPicture InsertOrUpdateSWfsOperationPicture(SWfsOperationPicture model) { if (model.PictureManageId <= 0) { DapperUtil.Insert <SWfsOperationPicture>(model); } else { DapperUtil.Update <SWfsOperationPicture>(model); } return(model); }
public string SaveVsinsHotProducts() { string hotProductId = Request.Form["hotProductId"]; string productNo = Request.Form["productNo"]; string status = Rq.GetStringForm("status"); string beginTime = Rq.GetStringForm("dateBegin"); string endTime = Rq.GetStringForm("dateEnd"); string description = Rq.GetStringForm("description"); string imgNo = string.Empty; Dictionary <string, string> picResDic = new Dictionary <string, string>(); if (Request.Files["imgfile"] != null && Request.Files["imgfile"].ContentLength > 0) { picResDic = new CommonService().PostImg(Request.Files["imgfile"], "width:640,Height:0,Length:200"); if (picResDic.Keys.Contains("error")) { return("{ \"result\":\"error\", \"msg\":\"" + picResDic["error"] + "\" }"); } if (picResDic.Keys.Contains("success")) { imgNo = picResDic["success"]; } } else { imgNo = Rq.GetStringForm("imgNo"); } SWfsHotProduct hotproduct = DapperUtil.QueryByIdentity <SWfsHotProduct>(hotProductId); if (hotproduct == null) { hotproduct = new SWfsHotProduct(); hotproduct.CreateDate = DateTime.Now; } hotproduct.Description = description; hotproduct.EndDate = Convert.ToDateTime(endTime); hotproduct.PicFileNo = imgNo; hotproduct.ProductNo = productNo; hotproduct.StartDate = Convert.ToDateTime(beginTime); hotproduct.Status = short.Parse(status); hotproduct.Type = 1; if (hotproduct.HotProductId != 0) { DapperUtil.Update <SWfsHotProduct>(hotproduct); } else { DapperUtil.Insert <SWfsHotProduct>(hotproduct); } return("{\"result\":\"success\"}"); }
//添加查询历史记录 public int InsertHistory(Parameters p, string url, string userID) { //StringBuilder str = new StringBuilder(); //if (p.productNO != null && p.productNO != "") //{ // str.Append(p.productNO+">"); //} //if (p.productName != null && p.productName != "") //{ // str.Append(p.productName+">"); //} //if (p.categoryNO != null && p.categoryNO != "") //{ // str.Append("&categoryNO=" + p.categoryNO); //} //if (p.brandNO != null && p.brandNO != "") //{ // str.Append("&brandNO=" + p.brandNO); //} //if (p.colorId != null && p.colorId != "") //{ // str.Append("&colorId=" + p.colorId); //} //if (p.shelfDate != null && p.shelfDate != "") //{ // str.Append("&shelfDate=" + p.shelfDate); //} //if (p.price != null && p.price != "") //{ // str.Append("&price=" + p.price); //} //if (p.stock != null && p.stock != "") //{ // str.Append("&stock=" + p.stock); //} //if (p.discountRate != null && p.discountRate != "") //{ // str.Append("&discountRate=" + p.discountRate); //} //if (p.start != null && p.start != "") //{ // str.Append("&start=" + p.start); //} SWfsSortHistory ssh = new SWfsSortHistory(); SearchSortService sssDal = new SearchSortService(); ssh.SearchUrl = url; ssh.Direction = sssDal.SelectDirection(p); ssh.CreateDate = System.DateTime.Now; ssh.UserId = userID; return(DapperUtil.Insert <SWfsSortHistory>(ssh, true)); //添加 }
/// <summary> /// 保存图片关联 /// </summary> /// <param name="items"></param> public void AddSWfsProductCommentPicRef(List <SWfsProductCommentPicRef> items) { try { foreach (var item in items) { DapperUtil.Insert <SWfsProductCommentPicRef>(item); } } catch (Exception ex) { } }
/// <summary> /// 添加用户评论 /// </summary> /// <param name="content"></param> /// <returns></returns> public int AddReview(SWfsProductComment content) { int returnValue = 0; try { returnValue = DapperUtil.Insert <SWfsProductComment>(content); } catch (Exception) { throw; } return(returnValue); }
/// <summary> /// 更新或添加楼层连接 /// </summary> /// <param name="links"></param> public void InsertOrUpdateFloorSWfsIndexModuleLink(List <SWfsIndexModuleLink> links) { foreach (SWfsIndexModuleLink item in links) { if (item.LinkId > 0) { DapperUtil.UpdatePartialColumns <SWfsIndexModuleLink>(item); } else { DapperUtil.Insert <SWfsIndexModuleLink>(item); } } }
//添加 public int BrandSpecialityStoreInsert(SWfsBrandSpecialityStore obj) { //判断是否存在重复 int count = DapperUtil.Query <int>("ComBeziWfs_SWfsBrandSpecialityStore_IsExistBrandNo", new { BrandNo = obj.BrandNo }).FirstOrDefault(); if (count == 0) { return(DapperUtil.Insert <SWfsBrandSpecialityStore>(obj, true)); } return(1); }
//编辑模板 public int EditeTemplate(SWfsBrandFlagShipTemplate obj) { if (obj.TemplateName == null) { return(0); } if (obj.TemplateNO == null) { return(0); } if (obj.TemplateType == 0) { return(0); } if (obj.TemplateDirection == null) { obj.TemplateDirection = ""; } if (obj.TemplatePath == null) { obj.TemplatePath = ""; } if (obj.CSSPath == null) { obj.CSSPath = ""; } if (obj.JSPath == null) { obj.JSPath = ""; } if (obj.TemplateDirection == null) { obj.TemplateDirection = ""; } obj.CreateDate = DateTime.Now; if (obj.TemplateID == 0)//添加 { //判断是否存在该编号 if (IsExists(obj.TemplateNO) > 0) { return(-1); } return(DapperUtil.Insert <SWfsBrandFlagShipTemplate>(obj, true)); } else { return(DapperUtil.Update <SWfsBrandFlagShipTemplate>(obj) ? 1 : 0); } }
//SWfsAppShopCategory public void aa(string namea) { //查询 Dictionary <string, object> dic = new Dictionary <string, object>();//用来拼接sql语句 dic.Add("bbb", "0000"); DapperUtil.Query <string>("ComBeziWfs_Brand_get", dic, new { name = namea }); DapperUtil.Execute("bbb", dic); //执行sql语句 DapperUtil.Insert <SWfsProductLabel>(new SWfsProductLabel()); //插入数据 DapperUtil.UpdatePartialColumns <SWfsProductLabel>(new //修改部分字段 到数据库 { LabelId = 12, //第一个一定放主键 name = '"' }); }
public int BrandSpecialityStoreEdits(string brandNo, int templateId, string specialityStoreType, string specialityStorePic, string brandIntroduce, DateTime dateCreate, int order) { if (order == 1) { return(DapperUtil.Insert <SWfsBrandSpecialityStore>(new SWfsBrandSpecialityStore { TemplateId = templateId, SpecialityStoreType = specialityStoreType, SpecialityStorePic = specialityStorePic, BrandIntroduce = brandIntroduce, DateCreate = dateCreate })); } else { return(Convert.ToInt32(DapperUtil.Update <SWfsBrandSpecialityStore>(new SWfsBrandSpecialityStore { TemplateId = templateId, SpecialityStoreType = specialityStoreType, SpecialityStorePic = specialityStorePic, BrandIntroduce = brandIntroduce, DateCreate = dateCreate }))); } }
//发布旗舰店信息 public int PublishFlagShipStoreInfo(SWfsBrandFlagShipStore obj) { //查询发布的旗舰店是否存在 var result = DapperUtil.Query <SWfsBrandFlagShipStoreSave>("ComBeziWfs_SWfsBrandFlagShipStore_ReadByBrandNo", new { BrandNo = obj.BrandNo }).FirstOrDefault(); if (result != null) { //修改 obj.FlagShipStoreId = result.FlagShipStoreId; return(DapperUtil.Update <SWfsBrandFlagShipStore>(obj) ? 1 : 0);//修改发布数据 } else { return(DapperUtil.Insert <SWfsBrandFlagShipStore>(obj, true));//增加发布数据 } }