protected void btnSave_Click(object sender, EventArgs e) { classid = this.Request.QueryString["classid"] ?? "";//上级栏目ID Cms.BLL.C_article bll = new Cms.BLL.C_article(); Repeater rptList = new Repeater(); switch (this.prolistview) { case "Txt": rptList = this.rptList1; break; default: rptList = this.rptList2; break; } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("Fielddocid")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } int counts = Cms.DBUtility.DbHelperSQL.ExecuteSql("update C_article set ordernumber=" + sortId + " where articleId='" + id + "'"); //修改 adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), bll.GetModel(id).title + "排序"); //记录日志 } JscriptMsg("保存排序成功!", "integralList.aspx?classid=" + classid, "Success"); }
public string getParent(string article_id) { string result = ""; if (new Cms.BLL.C_article().Exists(Convert.ToInt32(article_id))) { result = new Cms.BLL.C_article().GetModel(Convert.ToInt32(article_id)).parentId.ToString(); } return(result); }
public static void RepeaterArticleClassIdWhere(int top, int classId, string where, Repeater rep) { string classIdString = ToAspx.getcloumnid(classId); DataSet ds = new Cms.BLL.C_article().GetList(top, "parentId in (" + classIdString + ") and ishidden=0 " + where, "ordernumber desc ,articleId desc"); if (ds != null && ds.Tables[0].Rows.Count > 0) { rep.DataSource = ds.Tables[0].DefaultView; rep.DataBind(); } }
public static int getArticleCount(int id) { int result = 0; Cms.Model.C_article model = new Cms.BLL.C_article().GetModel(id); DataSet ds = new Cms.BLL.C_article().GetList("parentId=" + model.parentId); if (ds != null && ds.Tables[0].Rows.Count > 0) { result = ds.Tables[0].Rows.Count; } return(result); }
public static string getContentUrlsub(int id) { string result = ""; Cms.BLL.C_Column bllColumn = new Cms.BLL.C_Column(); Cms.BLL.C_article bllarticle = new Cms.BLL.C_article(); int parentid = Convert.ToInt32(bllarticle.GetModel(id).parentId); DataSet ds = bllColumn.GetList("classId=" + parentid); if (ds != null && ds.Tables[0].Rows.Count > 0) { result = GetToHtml(ds.Tables[0].Rows[0]["contentUrl"].ToString()); } return(result); }
public void getCply() { DataSet dsCply = new Cms.BLL.C_article().GetList(2, "parentId=125", "orderNumber desc,articleId desc"); if (dsCply != null && dsCply.Tables[0].Rows.Count > 0) { string strJson = ConvertJson.ToJson(dsCply); Response.Write(strJson); Response.End(); } else { Response.Write(""); Response.End(); } }
public void getNext() { string id = Request["id"]; int parentId = new Cms.BLL.C_article().GetModel(Convert.ToInt32(id)).parentId.Value; DataSet ds = new Cms.BLL.C_article().GetList(1, "parentId='" + parentId + "' and articleId<" + id, "articleId desc"); if (ds != null && ds.Tables[0].Rows.Count > 0) { string strJson = ConvertJson.ToJson(ds); Response.Write(strJson); Response.End(); } else { Response.Write(""); Response.End(); } }
public void getArticleDe() { string id = Request["id"]; DataSet ds = new Cms.BLL.C_article().GetList(1, "articleId=" + id, "articleId desc"); if (ds != null && ds.Tables[0].Rows.Count > 0) { string strJson = ConvertJson.ToJson(ds); Response.Write(strJson); Response.End(); } else { Response.Write(""); Response.End(); } }
public static string nextWap(int articleId) { string Temp = "<a href='{linkUrl}' title='{title}' class='zhright_btn'><div class='next'>下一篇</div></a>"; DataSet ds = new Cms.BLL.C_article().GetList(1, "parentId='" + new Cms.BLL.C_article().GetModel(articleId).parentId + "' and articleId>" + articleId, "ordernumber desc ,articleId desc"); if (ds != null && ds.Tables[0].Rows.Count > 0) { Temp = Temp.Replace("{linkUrl}", getContentUrl(Convert.ToInt32(ds.Tables[0].Rows[0]["parentId"]), Convert.ToInt32(ds.Tables[0].Rows[0]["articleId"]))); Temp = Temp.Replace("{title}", ds.Tables[0].Rows[0]["title"].ToString()); Temp = Temp.Replace("{pagenum}", ds.Tables[0].Rows[0]["title"].ToString()); } else { Temp = Temp.Replace("{linkUrl}", "javascript:void(0);"); Temp = Temp.Replace("{title}", "没有下一篇了"); Temp = Temp.Replace("{pagenum}", "没有下一篇了"); } return(Temp); }
private void cart_goods_add() { int iPro_Quantity = 1; bool IsSame = false; //表示是否为同一种商品 Cms.BLL.C_article bPro = new Cms.BLL.C_article(); //这是购物车的逻辑层 string sPro_Id = Request.QueryString["articleId"].ToString(); string sPro_note = "颜色:" + Request.QueryString["note"].ToString(); foreach (DataRow dr in CartTable.Rows) //遍历DataTable { if (dr[0].ToString() == sPro_Id) { iPro_Quantity = Convert.ToInt32(dr[2].ToString()); iPro_Quantity++; dr[2] = iPro_Quantity; dr[4] = iPro_Quantity * Convert.ToDecimal(dr[3].ToString()); dr[5] = dr[5].ToString(); IsSame = true; } } if (!IsSame) //DataTable里没有,则创建一行该商品 { dr = CartTable.NewRow(); dr[0] = sPro_Id; dr[1] = bPro.GetModel(Convert.ToInt32(sPro_Id)).title; dr[2] = iPro_Quantity; dr[3] = Convert.ToDecimal("1"); dr[4] = iPro_Quantity * Convert.ToDecimal(dr[3].ToString()); dr[5] = sPro_note; CartTable.Rows.Add(dr); } Session["CartShop"] = CartTable; //添加到Session中 Session.Timeout = 1440; //DataSet ds = new DataSet(); //ds.Tables.Add(CartTable); string result = Cms.DBUtility.ToJosn.ToJson(CartTable); Response.Write(result); Response.End(); }
public static string getActive(int id, string articleId, int classId) { string result = ""; if (id != null && articleId == null) { if (Convert.ToInt32(id) == classId) { result = "active"; } else { Cms.Model.C_Column model = new Cms.BLL.C_Column().GetModel(Convert.ToInt32(id)); if (model.parentId == classId) { result = "active"; } } } else { Cms.Model.C_article model = new Cms.BLL.C_article().GetModel(Convert.ToInt32(articleId)); if (model != null) { Cms.Model.C_Column modelC_Column = new Cms.BLL.C_Column().GetModel(Convert.ToInt32(model.parentId)); if (modelC_Column.classId == classId) { result = "active"; } else if ((modelC_Column.parentId == classId)) { result = "active"; } } } return(result); }
public void rptList2_Bind(int strparentId) { Cms.BLL.C_article bllarticle = new Cms.BLL.C_article(); Cms.Model.C_article modelarticle = new Cms.Model.C_article(); DataSet ds = bllarticle.GetList("parentId=" + strparentId + ""); if (ds.Tables[0].Rows.Count > 0) { switch (this.prolistview) { case "Txt": this.rptList2.Visible = false; this.rptList1.DataSource = ds; this.rptList1.DataBind(); break; default: this.rptList1.Visible = false; this.rptList2.DataSource = ds; this.rptList2.DataBind(); break; } } }
protected void btnts_Click(object sender, EventArgs e) { Cms.BLL.C_article cb = new Cms.BLL.C_article(); int id = int.Parse(tbid.Text.Trim() == ""?"0":tbid.Text.Trim()); if (id == 0) { return; } DataTable dt = cb.GetList("articleId=" + id).Tables[0]; if (dt.Rows.Count == 0) { ScriptManager.RegisterStartupScript(UpdatePanel2, UpdatePanel2.GetType(), "", "alert('文章不存在!');", true); return; } DataRow dr = dt.Rows[0]; string strurl = tburls.Text.Trim(); if (strurl == "") { ScriptManager.RegisterStartupScript(UpdatePanel2, UpdatePanel2.GetType(), "", "alert('请输入文章路径!');", true); return; } string[] suser = GetPage4("https://api.weixin.qq.com/cgi-bin/user/get?access_token=" + hdid.Text, "").Split(','); //string str = UploadMultimedia(hdid.Text, "image"); string surl = "http://" + HttpContext.Current.Request.Url.Host.ToString(); string spic = surl + dr["photourl"].ToString(); foreach (string s in suser) { if (s == "") { continue; } StringBuilder sb = new StringBuilder(); //sb.Append("{"); //sb.Append("\"touser\":"+s+","); //sb.Append("\"msgtype\":\"image\","); //sb.Append("\"image\":"); //sb.Append("{"); //sb.Append("\"media_id\":\"" + str + "\""); //sb.Append("}"); //sb.Append("}"); sb.Append("{"); sb.Append("\"touser\":" + s + ","); sb.Append("\"msgtype\":\"news\","); sb.Append("\"news\":{"); sb.Append("\"articles\":["); sb.Append("{"); sb.Append("\"title\":\"" + dr["title"].ToString() + "\","); sb.Append("\"description\":\"" + dr["intro"].ToString() + "\","); sb.Append("\"url\":\"" + strurl + "\","); sb.Append("\"picurl\":\"" + spic + "\""); sb.Append(" }"); sb.Append("]"); sb.Append("}"); sb.Append("}"); setinfo("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" + hdid.Text.Trim(), sb.ToString()); } //StringBuilder sb = new StringBuilder(); //string str = UploadMultimedia(hdid.Text, "image"); //sb.Append("{"); //sb.Append("\"articles\": ["); //sb.Append("{"); //sb.Append("\"thumb_media_id\":\"" + str + "\","); //sb.Append("\"author\":\"\","); //sb.Append("\"title\":\"小额贷款审计我之见\","); //sb.Append("\"content_source_url\":\"http://www.muhn.org.cn/contents9.html\","); //sb.Append("\"content\":\"自2008年银监会、央行发布《关于小额贷款公司试点的指导意见》以来\","); //sb.Append("\"digest\":\"digest\","); //sb.Append("\"show_cover_pic\":\"1\""); //sb.Append("}"); //sb.Append("]"); //sb.Append("}"); //GetPage3("https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token="+hdid.Text, sb.ToString(), 1); Cms.BLL.wx_info wx = new Cms.BLL.wx_info(); Cms.Model.wx_info mwx = new Cms.Model.wx_info(); dt = wx.GetList("id=2").Tables[0]; bool bl = false; if (dt.Rows.Count > 0) { mwx = wx.GetModel(2); mwx.AppId = tbid.Text.Trim(); mwx.AppSecret = tburls.Text.Trim(); bl = wx.Update(mwx); } else { mwx.AppId = tbid.Text.Trim(); mwx.AppSecret = tburls.Text.Trim(); if (wx.Add(mwx) > 0) { bl = true; } } ScriptManager.RegisterStartupScript(UpdatePanel2, UpdatePanel2.GetType(), "", "alert('推送成功!');", true); }
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("Fielddocid")).Value); Cms.BLL.C_article bll = new Cms.BLL.C_article(); Cms.Model.C_article model = bll.GetModel(id); LinkButton lb = (LinkButton)e.Item.FindControl("lbedit"); Cms.BLL.C_Column cm = new Cms.BLL.C_Column(); string classid = DTRequest.GetQueryString("classid"); string classname = cm.GetModel(int.Parse(classid)).className; bool blEdit = adminUser.setpurview(classname, "Edit"); if (!blEdit) { lb.Visible = false; } switch (e.CommandName) { case "lbtnIsMsg": if (model.is_msg == 1) { this.updateSate(id, "is_msg=0"); } else { this.updateSate(id, "is_msg=1"); } break; case "lbtnIsTop": if (model.isTop == 1) { this.updateSate(id, "isTop=0"); } else { this.updateSate(id, "isTop=1"); } break; case "lbtnIsRed": if (model.isRecommend == 1) { this.updateSate(id, "isRecommend=0"); } else { this.updateSate(id, "isRecommend=1"); } break; case "lbtnIsHot": if (model.isHot == 1) { this.updateSate(id, "isHot=0"); } else { this.updateSate(id, "isHot=1"); } break; case "lbtnIsSlide": if (model.is_slide == 1) { this.updateSate(id, "is_slide=0"); } else { this.updateSate(id, "is_slide=1"); } break; } }
//资料导入方法 public static string ExeclData(string clientid, string CustTypeMax, string CustTypeMin, string CustTypeSub) { { //获取上传的菜单名称和路径 string tempMenPath = System.Web.HttpContext.Current.Server.MapPath("~") + "\\Upload\\file\\" + clientid;// StringBuilder sbResult = new StringBuilder(""); //string strconn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + tempMenPath + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\""; string strconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + tempMenPath + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\""; OleDbConnection conn = new OleDbConnection(strconn); conn.Open(); string sql; sql = "SELECT * FROM [Sheet1$]"; DataSet objDS = new DataSet(); OleDbDataAdapter objadp = new OleDbDataAdapter(sql, conn); objadp.Fill(objDS); DataTable MenDt = objDS.Tables[0]; conn.Close(); int result = 0; foreach (DataRow dr in MenDt.Select()) { try { Cms.BLL.C_article bllarticle = new Cms.BLL.C_article(); Cms.Model.C_article modelarticle = new Cms.Model.C_article(); modelarticle.parentId = 78; //栏目id modelarticle.title = dr[2].ToString(); //标题 modelarticle.englishtitle = ""; //英文标题 modelarticle.orderNumber = 0; //排序 modelarticle.photoUrl = ""; //缩略图 modelarticle.intro = ""; //简介 modelarticle.content = dr[4].ToString(); //内容 modelarticle.seoTitle = ""; //seo标题 modelarticle.seoKeyword = ""; //seo关键词 modelarticle.seoDescription = ""; //seo描述 modelarticle.isRecommend = 1; //推荐 modelarticle.isChannel = ""; //栏目推荐 modelarticle.isHidden = 1; //是否隐藏 modelarticle.isCheck = 1; //是否审核发布 modelarticle.isHot = 1; //是否热门文章 modelarticle.isTop = 1;//是否置顶 modelarticle.is_msg = 1; modelarticle.is_slide = 1; modelarticle.hits = 1; //点击量 modelarticle.Attachment = ""; modelarticle.expClass = ""; // modelarticle.editTime = DateTime.Now; //最后编辑时间 modelarticle.updateTime = DateTime.Now; //添加时间 modelarticle.txtLinkUrl = ""; modelarticle.contentUrl = ""; modelarticle.txtsource = ""; modelarticle.txtauthor = ""; modelarticle.w_LinkUrl = ""; modelarticle.w_contentUrl = ""; modelarticle.w_intro = ""; modelarticle.w_content = ""; modelarticle.e_LinkUrl = ""; modelarticle.e_contentUrl = ""; modelarticle.e_source = ""; modelarticle.e_author = ""; modelarticle.e_intro = ""; modelarticle.e_content = ""; modelarticle.e_seoTitle = ""; modelarticle.e_seoKeyword = ""; modelarticle.e_seoDescription = ""; //modelarticle.textParam1 = ""; //modelarticle.textParam2 = ""; //modelarticle.textParam3 = ""; //modelarticle.textParam4 = ""; //modelarticle.textParam5 = ""; result = bllarticle.Add(modelarticle); if (result > 1) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into C_article_attribute_value("); strSql.Append("article_id,gra_time,card_id,cord_number)"); strSql.Append(" values ("); strSql.Append("@article_id,@gra_time,@card_id,@cord_number)"); SqlParameter[] parameters = { new SqlParameter("@article_id", SqlDbType.Int, 4), new SqlParameter("@gra_time", SqlDbType.NVarChar, 255), new SqlParameter("@card_id", SqlDbType.NVarChar, 100), new SqlParameter("@cord_number", SqlDbType.NVarChar, 50) }; parameters[0].Value = result; parameters[1].Value = dr[5].ToString(); parameters[2].Value = dr[1].ToString(); parameters[3].Value = dr[3].ToString(); int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); sbResult.Append("增加成功 <br />"); } else { sbResult.Append("增加失败 <br />"); } } catch { continue; } } return(sbResult.ToString()); //更新到数据库中 } }
/// <summary> ///商品导入方法 /// </summary> /// <param name="clientid"></param> /// <param name="CustTypeMax"></param> /// <param name="CustTypeMin"></param> /// <param name="CustTypeSub"></param> /// <returns></returns> public static string ExeclData(string clientid, string classid, string CustTypeMin, string CustTypeSub) { { //获取上传的菜单名称和路径 string tempMenPath = System.Web.HttpContext.Current.Server.MapPath("~") + "\\Upload\\file\\" + clientid;// StringBuilder sbResult = new StringBuilder(""); //string strconn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + tempMenPath + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\""; string strconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + tempMenPath + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\""; OleDbConnection conn = new OleDbConnection(strconn); conn.Open(); string sql; sql = "SELECT * FROM [Sheet1$]"; DataSet objDS = new DataSet(); OleDbDataAdapter objadp = new OleDbDataAdapter(sql, conn); objadp.Fill(objDS); DataTable MenDt = objDS.Tables[0]; conn.Close(); int result = 0; foreach (DataRow dr in MenDt.Select()) { try { Cms.BLL.C_article bllarticle = new Cms.BLL.C_article(); Cms.Model.C_article modelarticle = new Cms.Model.C_article(); modelarticle.parentId = Convert.ToInt32(classid); //栏目id modelarticle.title = dr[0].ToString(); //标题 modelarticle.englishtitle = ""; //英文标题 modelarticle.orderNumber = 0; //排序 modelarticle.photoUrl = ""; //缩略图 modelarticle.intro = ""; //简介 modelarticle.content = dr[1].ToString(); //内容 modelarticle.seoTitle = ""; //seo标题 modelarticle.seoKeyword = ""; //seo关键词 modelarticle.seoDescription = ""; //seo描述 modelarticle.isRecommend = 0; //推荐 modelarticle.isChannel = ""; //栏目推荐 modelarticle.isHidden = 0; //是否隐藏 modelarticle.isCheck = 0; //是否审核发布 modelarticle.isHot = 0; //是否热门文章 modelarticle.isTop = 0; //是否置顶 modelarticle.is_msg = 0; modelarticle.is_slide = 0; modelarticle.hits = 1; //点击量 modelarticle.Attachment = ""; modelarticle.expClass = ""; // modelarticle.editTime = DateTime.Now; //最后编辑时间 modelarticle.updateTime = DateTime.Now; //添加时间 modelarticle.txtLinkUrl = ""; modelarticle.contentUrl = ""; modelarticle.txtsource = ""; modelarticle.txtauthor = ""; #region 手机|英文信息 modelarticle.w_LinkUrl = ""; modelarticle.w_contentUrl = ""; modelarticle.w_intro = ""; modelarticle.w_content = ""; modelarticle.e_LinkUrl = ""; modelarticle.e_contentUrl = ""; modelarticle.e_source = ""; modelarticle.e_author = ""; modelarticle.e_intro = ""; modelarticle.e_content = ""; modelarticle.e_seoTitle = ""; modelarticle.e_seoKeyword = ""; modelarticle.e_seoDescription = ""; string channel_name = new Cms.BLL.C_Column().GetModel(Convert.ToInt32(classid)).className.ToString(); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("sub_title", ""); modelarticle.fields = dic; //扩展字段赋值 #endregion result = bllarticle.Add(modelarticle); if (result > 1) { #region 产品信息 Cms.BLL.C_article_product bll_product = new Cms.BLL.C_article_product(); Cms.Model.C_article_product model_product = new Cms.Model.C_article_product(); model_product.article_id = result; model_product.price = Convert.ToDecimal(dr[2].ToString()); model_product.marketPrice = Convert.ToDecimal(dr[3].ToString()); model_product.integral = Convert.ToInt32(dr[4].ToString()); model_product.stock = Convert.ToInt32(dr[5].ToString()); model_product.is_integral = Convert.ToInt32(0); model_product.s_version = Convert.ToInt32(0); #endregion sbResult.Append("导入成功! <br />"); } else { sbResult.Append("导入失败! <br />"); } } catch { continue; } } return(sbResult.ToString()); //更新到数据库中 } }