internal B2b_company_image GetimageByComid(int comid, int id, int channelcompanyid = 0) { const string sqlTxt = @"SELECT * FROM [dbo].[b2b_company_image] where com_id=@comid and id=@id and channelcompanyid=@channelcompanyid"; var cmd = sqlHelper.PrepareTextSqlCommand(sqlTxt); cmd.CommandType = CommandType.Text; cmd.AddParam("@comid", comid); cmd.AddParam("@id", id); cmd.AddParam("@channelcompanyid", channelcompanyid); using (var reader = cmd.ExecuteReader()) { B2b_company_image u = null; while (reader.Read()) { u = new B2b_company_image { Id = reader.GetValue <int>("Id"), Com_id = reader.GetValue <int>("com_id"), Imgurl = reader.GetValue <int>("Imgurl"), Imgurl_address = reader.GetValue <string>("Imgurl_address"), Linkurl = reader.GetValue <string>("Linkurl"), Title = reader.GetValue <string>("title"), Typeid = reader.GetValue <int>("Typeid"), State = reader.GetValue <int>("State") }; } return(u); } }
public int InsertOrUpdate(B2b_company_image imageset) { using (var helper = new SqlHelper()) { var id = new InternalB2bCompanyImage(helper).InsertOrUpdate(imageset); return(id); } }
public static string GetimageByComid(int comid, int id) { try { B2b_company_image com = B2bCompanyImageData.GetimageByComid(comid, id); return(JsonConvert.SerializeObject(new { type = 100, msg = com })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); } }
//图片添加修改 public static string InsertOrUpdate(B2b_company_image saleset) { try { var saledata = new B2bCompanyImageData(); var crmid = saledata.InsertOrUpdate(saleset); return(JsonConvert.SerializeObject(new { type = 100, msg = crmid })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
public int InsertOrUpdate(B2b_company_image model) { var cmd = sqlHelper.PrepareStoredSqlCommand(SQLInsertOrUpdate); cmd.AddParam("@Id", model.Id); cmd.AddParam("@Comid", model.Com_id); cmd.AddParam("@Title", model.Title); cmd.AddParam("@Typeid", model.Typeid); cmd.AddParam("@Linkurl", model.Linkurl); cmd.AddParam("@Imgurl", model.Imgurl); cmd.AddParam("@Channelcompanyid", model.Channelcompanyid); var parm = cmd.AddReturnValueParameter("ReturnValue"); cmd.ExecuteNonQuery(); return((int)parm.Value); }
private void ShowImgBind() { //var comid = Context.Request["comid"].ConvertTo<int>(0); var comid = UserHelper.CurrentCompany.ID; if (id != 0) { B2b_company_image imagemodel = B2bCompanyImageData.GetimageByComid(comid, id); if (imagemodel != null) { Title = imagemodel.Title; linkurl = imagemodel.Linkurl; FileUploadModel identityFileUpload = new FileUploadData().GetFileById(imagemodel.Imgurl); if (identityFileUpload != null) { headPortraitImgSrc = identityFileUpload.Relativepath; } } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string oper = context.Request["oper"].ConvertTo <string>(""); if (oper != "") { if (oper == "editcdirectset") { var directsellsetid = context.Request["directsellsetid"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var userid = context.Request["userid"].ConvertTo <int>(0); var title = context.Request["title"].ConvertTo <string>(""); var kefu = context.Request["kefu"].ConvertTo <string>(""); var buttom = context.Request["bottom"].ConvertTo <string>(""); var smsaccount = context.Request["smsaccount"].ConvertTo <string>(""); var smspass = context.Request["smspass"].ConvertTo <string>(""); var smssign = context.Request["smssign"].ConvertTo <string>(""); var logo = context.Request["logo"].ConvertTo <string>(""); var smalllogo = context.Request["smalllogo"].ConvertTo <string>(""); B2b_company_saleset saleset = new B2b_company_saleset() { Id = directsellsetid, Com_id = comid, Dealuserid = userid, Title = title, Service_Phone = kefu, Copyright = buttom, Smsaccount = smsaccount, Smspass = smspass, Smssign = smssign, Model_style = (int)ModelStyle.DefaultModel, Payto = 0, WorkingHours = "", Tophtml = "", BottomHtml = "", Logo = logo, Smalllogo = smalllogo, Compressionlogo = smalllogo }; var data = DirectSellJsonData.InsertOrUpdate(saleset); context.Response.Write(data); } //修改短信设置 if (oper == "editsmsset") { var directsellsetid = context.Request["directsellsetid"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var smsaccount = context.Request["smsaccount"].ConvertTo <string>(""); var smspass = context.Request["smspass"].ConvertTo <string>(""); var smssign = context.Request["smssign"].ConvertTo <string>(""); var smstype = context.Request["smstype"].ConvertTo <int>(0); var subid = context.Request["subid"].ConvertTo <string>(""); if (smstype == 1) { smssign = smssign.Trim(); if (smssign.Substring(0, 1) != "【") { var data1 = "{\"type\":1,\"msg\":\"签名必须以左中文左括号 【 \"}"; context.Response.Write(data1); return; } if (smssign.Substring(smssign.Length - 1, 1) != "】") { var data2 = "{\"type\":1,\"msg\":\"签名必须以右中文左括号 】\"}"; context.Response.Write(data2); return; } } B2b_company_saleset saleset = new B2b_company_saleset() { Id = directsellsetid, Com_id = comid, Smsaccount = smsaccount, Smspass = smspass, Smssign = smssign, Smstype = smstype, Subid = subid }; var data = DirectSellJsonData.Updatesms(saleset); context.Response.Write(data); } if (oper == "getdirectsellset") { var comid = context.Request["comid"]; var data = DirectSellJsonData.GetDirectSellByComid(comid); context.Response.Write(data); } if (oper == "getfileupload") { var id = context.Request["id"]; var data = DirectSellJsonData.GetFileupload(id); context.Response.Write(data); } if (oper == "getcomlogobyproid") { var proid = context.Request["proid"].ConvertTo <int>(0); var data = DirectSellJsonData.Getcomlogobyproid(proid); context.Response.Write(data); } if (oper == "getimagelist") { var typeid = context.Request["typeid"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var pageindex = context.Request["pageindex"].ConvertTo <int>(0); var pagesize = context.Request["pagesize"].ConvertTo <int>(10); //var usetype = context.Request["usetype"].ConvertTo<int>(0); var data = DirectSellJsonData.Getimagelist(comid, typeid, pageindex, pagesize); context.Response.Write(data); } if (oper == "getchannelimagelist") { var typeid = context.Request["typeid"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0); var pageindex = context.Request["pageindex"].ConvertTo <int>(0); var pagesize = context.Request["pagesize"].ConvertTo <int>(10); var data = DirectSellJsonData.Getchannelimagelist(comid, typeid, channelcompanyid, pageindex, pagesize); context.Response.Write(data); } if (oper == "pagegetimagelist") { var typeid = context.Request["typeid"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var pageindex = context.Request["pageindex"].ConvertTo <int>(0); var pagesize = context.Request["pagesize"].ConvertTo <int>(10); var data = DirectSellJsonData.PageGetimagelist(comid, typeid); context.Response.Write(data); } if (oper == "getimagebyid") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var data = DirectSellJsonData.GetimageByComid(comid, id); context.Response.Write(data); } if (oper == "getchannelimagebyid") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0); var data = DirectSellJsonData.GetchannelimageByComid(comid, id, channelcompanyid); context.Response.Write(data); } //修改图片 if (oper == "editimage") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var typeid = context.Request["typeid"].ConvertTo <int>(0); var Imgurl = context.Request["imgurl"].ConvertTo <int>(0); var Linkurl = context.Request["Linkurl"].ConvertTo <string>(""); var title = context.Request["title"].ConvertTo <string>(""); B2b_company_image imagemodel = new B2b_company_image() { Id = id, Com_id = comid, Typeid = typeid, Imgurl = Imgurl, Linkurl = Linkurl, Title = title, Channelcompanyid = 0, }; var data = DirectSellJsonData.InsertOrUpdate(imagemodel); context.Response.Write(data); } //修改图片 if (oper == "editchannelimage") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var typeid = context.Request["typeid"].ConvertTo <int>(0); var Imgurl = context.Request["imgurl"].ConvertTo <int>(0); var Linkurl = context.Request["Linkurl"].ConvertTo <string>(""); var title = context.Request["title"].ConvertTo <string>(""); var channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0); B2b_company_image imagemodel = new B2b_company_image() { Id = id, Com_id = comid, Typeid = typeid, Imgurl = Imgurl, Linkurl = Linkurl, Title = title, Channelcompanyid = channelcompanyid, }; var data = DirectSellJsonData.ChannelInsertOrUpdate(imagemodel); context.Response.Write(data); } //删除图片 if (oper == "deleteimage") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var data = DirectSellJsonData.Deleteimage(comid, id); context.Response.Write(data); } //删除图片 if (oper == "deletechannelimage") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0); var data = DirectSellJsonData.Deletechannelimage(comid, id, channelcompanyid); context.Response.Write(data); } //删除图片 if (oper == "updwonstate") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0); var data = DirectSellJsonData.UpDownState(comid, id, channelcompanyid); context.Response.Write(data); } if (oper == "getmenulist") { var comid = context.Request["comid"].ConvertTo <int>(0); var pageindex = context.Request["pageindex"].ConvertTo <int>(0); var pagesize = context.Request["pagesize"].ConvertTo <int>(10); var usetype = context.Request["usetype"].ConvertTo <int>(0); var menuindex = context.Request["menuindex"].ConvertTo <int>(0); var data = DirectSellJsonData.Getmenulist(comid, pageindex, pagesize, usetype, menuindex); context.Response.Write(data); } if (oper == "getconsultantlist") { var comid = context.Request["comid"].ConvertTo <int>(0); var pageindex = context.Request["pageindex"].ConvertTo <int>(0); var pagesize = context.Request["pagesize"].ConvertTo <int>(10); var channelid = context.Request["channelid"].ConvertTo <int>(0); var data = DirectSellJsonData.Getconsultantlist(comid, pageindex, pagesize); context.Response.Write(data); } if (oper == "getmenubyid") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var data = DirectSellJsonData.GetMenuByComid(comid, id); context.Response.Write(data); } if (oper == "getconsultantbyid") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var data = DirectSellJsonData.GetConsultantByComid(comid, id); context.Response.Write(data); } if (oper == "getchannelprolist") { var id = context.Request["id"].ConvertTo <int>(0);//渠道ID var comid = context.Request["comid"].ConvertTo <int>(0); var data = DirectSellJsonData.GetChannelProList(comid, id); context.Response.Write(data); } //修改栏目 if (oper == "editmenu") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var typeid = context.Request["typeid"].ConvertTo <int>(0); var Imgurl = context.Request["imgurl"].ConvertTo <int>(0); var Linkurl = context.Request["Linkurl"].ConvertTo <string>(""); var Linktype = context.Request["Linktype"].ConvertTo <int>(0); var name = context.Request["name"].ConvertTo <string>(""); var fonticon = context.Request["fonticon"].ConvertTo <string>(""); var usetype = context.Request["usetype"].ConvertTo <int>(0); var usestyle = context.Request["usestyle"].ConvertTo <int>(0); var projectlist = context.Request["projectlist"].ConvertTo <int>(0); var prolist = context.Request["prolist"].ConvertTo <string>(""); var Menutype = context.Request["Menutype"].ConvertTo <int>(0); var menuindex = context.Request["menuindex"].ConvertTo <int>(0); var menuviewtype = context.Request["menuviewtype"].ConvertTo <int>(0); B2b_company_menu menumodel = new B2b_company_menu() { Id = id, Com_id = comid, Imgurl = Imgurl, Linkurl = Linkurl, Linktype = Linktype, Name = name, Fonticon = fonticon, Usestyle = usestyle, Usetype = usetype, Projectlist = projectlist, Prolist = prolist, Menutype = Menutype, menuindex = menuindex, menuviewtype = menuviewtype }; var data = DirectSellJsonData.InsertOrUpdate(menumodel); context.Response.Write(data); } if (oper == "MenuSort") { string ids = context.Request["ids"].ConvertTo <string>(""); string data = DirectSellJsonData.MenuSort(ids); context.Response.Write(data); } //修改底部按钮 if (oper == "editbutton") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var linkurl = context.Request["linkurl"].ConvertTo <string>(""); var name = context.Request["name"].ConvertTo <string>(""); var linkurlname = context.Request["linkurlname"].ConvertTo <string>(""); var sort = context.Request["sort"].ConvertTo <int>(0); var linktype = context.Request["linktype"].ConvertTo <int>(0); B2b_company_Button buttonmodel = new B2b_company_Button() { Id = id, Comid = comid, Linkurl = linkurl, Name = name, Linkurlname = linkurlname, Sort = sort, Linktype = linktype }; var data = DirectSellJsonData.ButtonInsertOrUpdate(buttonmodel); context.Response.Write(data); } //删除底部按钮 if (oper == "deletebutton") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var data = DirectSellJsonData.DeleteButton(comid, id); context.Response.Write(data); } //获取指定底部按钮 if (oper == "getbuttonbyid") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var data = DirectSellJsonData.GetButtonByComid(comid, id); context.Response.Write(data); } //获取指定底部按钮列表 if (oper == "getbuttonlist") { var comid = context.Request["comid"].ConvertTo <int>(0); var pageindex = context.Request["pageindex"].ConvertTo <int>(0); var pagesize = context.Request["pagesize"].ConvertTo <int>(10); var linktype = context.Request["linktype"].ConvertTo <int>(10); var data = DirectSellJsonData.GetButtonlist(comid, pageindex, pagesize, linktype); context.Response.Write(data); } //修改导航 if (oper == "editconsultant") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var typeid = context.Request["typeid"].ConvertTo <int>(0); var Imgurl = context.Request["imgurl"].ConvertTo <int>(0); var Linkurl = context.Request["Linkurl"].ConvertTo <string>(""); var Linktype = context.Request["Linktype"].ConvertTo <int>(0);//产品分类 var name = context.Request["name"].ConvertTo <string>(""); var fonticon = context.Request["fonticon"].ConvertTo <string>(""); var outdata = context.Request["outdata"].ConvertTo <int>(0); var proid = context.Request["proid"].ConvertTo <string>(""); var MaterialId = context.Request["MaterialId"].ConvertTo <string>(""); var channelid = context.Request["channelid"].ConvertTo <int>(0); //如果选择微信文章则 只记录文章选择的数据 if (outdata == 2) { proid = MaterialId; } B2b_company_menu menumodel = new B2b_company_menu() { Id = id, Com_id = comid, Imgurl = Imgurl, Linkurl = Linkurl, Linktype = Linktype, Name = name, Fonticon = fonticon, Outdata = outdata, Prolist = proid, Channelid = channelid, }; var data = DirectSellJsonData.ConsultantInsertOrUpdate(menumodel); context.Response.Write(data); } if (oper == "menuSort") { string ids = context.Request["ids"].ConvertTo <string>(""); string data = DirectSellJsonData.MenuSort(ids); context.Response.Write(data); } if (oper == "SortConsultant") { string ids = context.Request["ids"].ConvertTo <string>(""); string data = DirectSellJsonData.SortConsultant(ids); context.Response.Write(data); } //删除菜单 if (oper == "deletemenu") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var data = DirectSellJsonData.Deletemenu(comid, id); context.Response.Write(data); } //删除菜单 if (oper == "deleteConsultant") { var id = context.Request["id"].ConvertTo <int>(0); var comid = context.Request["comid"].ConvertTo <int>(0); var data = DirectSellJsonData.DeleteConsultant(comid, id); context.Response.Write(data); } } }
/// <summary> /// 选定模板 /// </summary> /// <param name="order"></param> /// <returns></returns> public static string SelectModel(int modelid, int comid) { using (var helper = new SqlHelper()) { int totalcount = 0; int totalcount1 = 0; try { B2bModelData modeldata = new B2bModelData(); var b2bmodel = modeldata.GetModelById(modelid); var b2bmodelmenu = modeldata.ModelMenuPageList(modelid, 1, 100, out totalcount); if (b2bmodel != null) { var delemodel = modeldata.DeleteSelectModel(comid);//删除已选择模板 H5_html model = new H5_html(); model.Comid = comid; model.Modelid = modelid; model.Style_str = b2bmodel.Style_str; model.Html_str = b2bmodel.Html_str; //插入模板 int orderid = modeldata.SelectModel(model); //原有图片都下线 var saledata = new B2bCompanyImageData(); var bannerlist = saledata.UpAllDownState(comid); //插入默认banner(也用于背景图片),重新选择模板后可能重复插入 B2bCompanyImageData modedata = new B2bCompanyImageData(); var imglist = modedata.GettypemodelidimageLibraryList(1, modelid, 1, 3, out totalcount1); if (imglist != null) { for (int i = 0; i < imglist.Count; i++) { B2b_company_image imagemodel = new B2b_company_image() { Id = 0, Com_id = comid, Typeid = 0, Imgurl = imglist[i].Imgurl, Linkurl = "#", Title = "#", Channelcompanyid = 0, }; var crmid = saledata.InsertOrUpdate(imagemodel); } } if (b2bmodelmenu != null)//首先判断模板里是否有默认栏目 { var insertmenu = 0; var imagedata = new B2bCompanyMenuData(); var list = imagedata.GetMenuList(comid, 1, 10, out totalcount);//如果已经有菜单的模板将不删除菜单,以后可增加判断是否删除菜单,有利于方便切换模板导航不需要重复修改,但容易出现因栏目图片不符新模板而影响使用。可先删除已有模板再进行切换 if (totalcount == 0) { insertmenu = modeldata.InsertSelectModelMenu(modelid, comid);//插入已选择模板菜单 } //var deletemenu= modeldata.DeleteSelectModelMenu(comid);//删除已选择模板菜单 return(JsonConvert.SerializeObject(new { type = 100, msg = insertmenu })); } } return(JsonConvert.SerializeObject(new { type = 1, msg = "选择模板错误,请重新尝试" })); } catch (Exception ex) { helper.Rollback(); return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); } } }