private DataTable MyBind(int psize, int cpage) { M_ModelInfo modMod = modBll.SelReturnModel(pubMod.PubModelID); string where = "1=1 "; List <SqlParameter> sp = new List <SqlParameter>(); if (!string.IsNullOrEmpty(skey.Value)) { if (!IsExistInFieldDT(skey_dp.SelectedValue)) { function.WriteErrMsg("搜索的字段不存在"); } where += " AND " + skey_dp.SelectedValue + " LIKE @skey"; sp.Add(new SqlParameter("skey", "%" + skey.Value.Trim() + "%")); } if (Status != -100) { where += " AND PubStart=" + Status; } if (ParentID > 0) { where += " AND Parentid=" + ParentID; } setting = PageSetting.Single(cpage, psize, modMod.TableName, "ID", where, "ID DESC", sp); DBCenter.SelPage(setting); foreach (DataRow dr in setting.dt.Rows) { dr["PubIP"] = dr["PubIP"] + "(" + IPScaner.IPLocation(DataConvert.CStr(dr["PubIP"])) + ")"; } RPT.ItemCount = setting.itemCount; return(setting.dt); }
protected void RPT_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = e.Item.DataItem as DataRowView; DataTable dt = new DataTable(); var rpt = e.Item.FindControl("User_RPT") as Repeater; var sp = e.Item.FindControl("usercount_sp") as System.Web.UI.HtmlControls.HtmlGenericControl; if (drv["ID"].ToString().Equals("0")) { UserDT.DefaultView.RowFilter = "Gid='' OR Gid IS NULL "; } else { string uids = StrHelper.PureIDSForDB(DataConvert.CStr(drv["MemberIDS"])); if (!string.IsNullOrEmpty(uids)) { UserDT.DefaultView.RowFilter = "UserID IN (" + uids + ")"; } } dt = UserDT.DefaultView.ToTable(); sp.InnerHtml = dt.Rows.Count.ToString(); rpt.DataSource = dt; rpt.DataBind(); } }
public static string GetFieldAndPara(DataTable dt, string pk = "id") { string sets = ""; foreach (DataRow dr in dt.Rows) { string field = DataConvert.CStr(dr["FieldName"]); switch (DBCenter.DB.DBType) { case "oracle": sets += WrapField(field) + "=:" + field + ","; break; case "mysql": sets += "`" + field + "`" + "=@" + field + ","; break; default: sets += "[" + field + "]" + "=@" + field + ","; break; } } sets = sets.TrimEnd(','); return(sets); }
public IActionResult Pubsinfo() { int pubId = DataConvert.CLng(GetParam("PubID")); M_Pub pubMod = pubBll.SelReturnModel(pubId); if (pubMod == null) { return(WriteErr("互动模块不存在")); } if (string.IsNullOrEmpty(pubMod.PubTableName)) { return(WriteErr("互动表为空")); } ViewBag.pubMod = pubMod; ViewBag.fieldDT = GetFieldDT(pubMod.PubModelID); PageSetting setting = B_Pub_Info.SelPage(CPage, PSize, new F_PubInfo() { tbname = pubMod.PubTableName, pid = DataConvert.CLng(GetParam("ParentID")), status = DataConvert.CLng(GetParam("status"), -100), uname = GetParam("uname"), skey = GetParam("skey"), skey_field = GetParam("skey_dp") }); foreach (DataRow dr in setting.dt.Rows) { dr["PubIP"] = dr["PubIP"] + "(" + IPScaner.IPLocation(DataConvert.CStr(dr["PubIP"])) + ")"; } if (Request.IsAjaxRequest()) { return(PartialView("Pubsinfo_List", setting)); } return(View(setting)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt = DBCenter.SelTop(1, "ID", "*", "ZL_Logo_Design", "Zstatus IN(0) AND ZType=1", ""); if (dt.Rows.Count < 1) { function.WriteErrMsg("取到的值为空"); } int id = DataConvert.CLng(dt.Rows[0]["ID"]); string content = DataConvert.CStr(dt.Rows[0]["LogoContent"]); Mid_Hid.Value = dt.Rows[0]["ID"].ToString(); if (string.IsNullOrEmpty(content)) { Ignore_Btn_Click(null, null); } Content_Hid.Value = content; Content_Hid.Value = StrHelper.DecompressString(Content_Hid.Value); string[] domainArr = new string[] { "https://www.raysandsigns.com/", "http://www.raysandsigns.com/", "https://raysandsigns.com/", "http://raysandsigns.com/", "http://win10:164/" }; foreach (string domain in domainArr) { Content_Hid.Value = Content_Hid.Value.Replace(domain, "/"); } } }
protected void Page_Load(object sender, EventArgs e) { B_Admin.CheckIsLogged(); if (Gid < 1) { function.WriteErrMsg("请指定需要关联的景点"); } DataTable modelDT = SqlHelper.JoinQuery("TOP 1 A.GeneralID,A.ItemID,A.Title,B.dtzb,B.Price", "ZL_CommonModel", "ZL_C_jdmx", "A.ItemID=B.ID", "A.GeneralID=" + Gid); if (modelDT.Rows.Count < 1 || string.IsNullOrEmpty(DataConvert.CStr(modelDT.Rows[0]["dtzb"]))) { function.WriteErrMsg("请先为景点设定坐标数据"); } double lng = 0; // 104.873626 double lat = 0; // 26.587309 if (!GetPointByStr(DataConvert.CStr(modelDT.Rows[0]["dtzb"]), out lng, out lat)) { function.WriteErrMsg("景点坐标不正确"); } string nids = "1"; DataTable nodeDT = nodeBll.SelByPid(1, true);//景点的父节点为1 foreach (DataRow dr in nodeDT.Rows) { nids += "," + dr["NodeID"]; } //---------------------------------------------------------- string where = "A.NodeID IN (" + nids + ")AND A.GeneralID!=" + Gid + " AND dtzb IS NOT NULL AND dtzb!=''"; DataTable dt = SqlHelper.JoinQuery("A.GeneralID,A.ItemID,A.Title,B.dtzb,B.Price", "ZL_CommonModel", "ZL_C_jdmx", "A.ItemID=B.ID", where); dt.Columns.Add(new DataColumn("distance", typeof(double))); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; string json = dr["dtzb"].ToString(); if (string.IsNullOrEmpty(json) || json.Equals("[]")) { continue; } double lng2, lat2; if (GetPointByStr(json, out lng2, out lat2)) { dr["distance"] = BaiduMap.GetShortDistance(lng, lat, lng2, lat2); } } dt.Columns.Remove("dtzb"); dt.DefaultView.Sort = "distance ASC"; dt = dt.DefaultView.ToTable(); DataTable result = dt.Clone(); for (int i = 0; i < 50 && i < dt.Rows.Count; i++) { result.Rows.Add(dt.Rows[i].ItemArray); } //result.DefaultView.Sort = "distance ASC"; RPT.DataSource = result; RPT.DataBind(); }
//-------------------附加币价格判断 public static string GetPriceStr(double price, object price_obj) { if (!HasPrice(price_obj)) //无附加商品价 { return(price.ToString("f2")); } string price_json = price_obj.ToString(); string html = "现金:<span>" + price.ToString("f2") + "</span>"; if (HasPrice(price_json)) { string json = DataConvert.CStr(price_json); M_LinPrice priceMod = JsonConvert.DeserializeObject <M_LinPrice>(json); if (priceMod.Purse > 0) { html += "|余额:<span>" + priceMod.Purse.ToString("f2") + "</span>"; } if (priceMod.Sicon > 0) { html += "|银币:<span>" + priceMod.Sicon.ToString("f0") + "</span>"; } if (priceMod.Point > 0) { html += "|积分:<span>" + priceMod.Point.ToString("f0") + "</span>"; } } return(html); }
//是否允许返修,退货等售后服务 public string GetRepair() { //已完结状态才能返修,退款等售后,其他情况下申请订单退款 string guess = DataConvert.CStr(Eval("GuessXML")); string result = ""; int orderStatus = Convert.ToInt32(Eval("OrderStatus")); if (Eval("AddStatus").ToString().Contains("exchange")) { result += "<a href='javascript:;' class='gray9'>已申请换货</a>"; } else if (Eval("AddStatus").ToString().Contains("repair")) { result += "<a href='javascript:;' class='gray9'>已申请返修</a>"; } else if (Eval("AddStatus").ToString().Contains("drawback")) { result += "<a href='javascript:;' class='gray9'>已申请退货</a>"; } else if (!string.IsNullOrEmpty(guess) && orderStatus >= (int)M_OrderList.StatusEnum.OrderFinish) { result += "<a href='ReqRepair.aspx?cid=" + Eval("CartID") + "' class='gray9'>返修/退换货</a>"; } return(result); }
public static IHtmlContent H_Radios(string name, DataTable dt, string vfield, string tfield, string selected = "") { string html = ""; if (dt == null || dt.Rows.Count < 1) { return(Raw("<div id=\"" + name + "\">无选项</div>")); } for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; string text = DataConvert.CStr(dr[tfield]); string value = DataConvert.CStr(dr[vfield]); string chked = ""; if (string.IsNullOrEmpty(selected) && i == 0) { chked = "checked=\"checked\""; } else if (value.Equals(selected)) { chked = "checked=\"checked\""; } html += "<label><input type=\"radio\" name=\"" + name + "\" value=\"" + value + "\" " + chked + ">" + text + "</label>"; } return(Raw(html)); }
//-------------Tools /// <summary> /// 转换为table后,筛选有效的价格>0且期限不为空 /// </summary> public DataTable P_GetValid(string info) { if (string.IsNullOrEmpty(info)) { return(null); } DataTable dt = JsonConvert.DeserializeObject <DataTable>(info); dt.Columns.Add("enable", typeof(int)); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; if (!TimeIsValid(DataConvert.CStr(dr["time"]))) { } else if (DataConvert.CLng(dr["price"]) <= 0) { } else { dr["enable"] = 1; } } dt.DefaultView.RowFilter = "enable='1'"; return(dt.DefaultView.ToTable()); }
/// <summary> /// 筛选获取数据 /// </summary> /// <param name="Type">0:后台,1:会员中心</param> /// <param name="customPath">后台路径</param> /// <param name="state">0:全部,1:启用,2:禁用</param> /// <returns></returns> public PageSetting SelPage(int cpage, int psize, F_Search filter) { List <SqlParameter> sp = new List <SqlParameter>(); string where = "1=1 "; if (!string.IsNullOrEmpty(filter.name)) { sp.Add(new SqlParameter("name", "%" + filter.name + "%")); where += " AND Name LIKE @name"; } if (filter.elite != -100) { where += " AND EliteLevel=" + filter.elite; } if (filter.type != -100) { where += " AND Type=" + filter.type; } if (filter.groupId != -100) { where += " AND (UserGroup='' OR ','+UserGroup+',' LIKE '%,'+'" + filter.groupId + "'+',%' ) "; } PageSetting setting = PageSetting.Single(cpage, psize, strTableName, PK, where, "OrderID ASC", sp); DBCenter.SelPage(setting); if (filter.type == 1) { for (int i = 0; i < setting.dt.Rows.Count; i++) { DataRow dr = setting.dt.Rows[i]; dr["FileUrl"] = DataConvert.CStr(dr["FileUrl"]).ToLower().Replace("/manage/", "/" + SiteConfig.SiteOption.ManageDir + "/"); } } return(setting); }
public MvcHtmlString GetTieStaues(DataRow dr) { string[] statues = DataConvert.CStr(dr["PostFlag"]).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string tieimgs = ""; if (statues.Length > 0) { for (int i = 0; i < statues.Length; i++) { switch (statues[i]) { case "Recommend": tieimgs += "<span class='fa fa-trophy'></span> "; break; } } } if (Convert.ToInt32(dr["OrderFlag"]) == 1) { tieimgs += "<span title='版面置顶' class='fa fa-eyedropper'></span>"; } if (Convert.ToInt32(dr["OrderFlag"]) == 2) { tieimgs += "<span title='全局置顶' class='fa fa-arrow-up'></span>"; } return(MvcHtmlString.Create(tieimgs)); }
public IActionResult Sort_API() { //tbname,字段规则 string orderStr = DataConvert.CStr(RequestEx["orderStr"]).Trim(','); if (string.IsNullOrEmpty(orderStr)) { return(Content(Failed.ToString())); } string[] orderArr = orderStr.Split(','); foreach (string item in orderArr) { int id = DataConvert.CLng(item.Split(':')[0]); int order = DataConvert.CLng(item.Split(':')[1]); switch (TbName.ToLower()) { case "commonmodel": DBCenter.UpdateSQL(TableName, "OrderID=" + order, "GeneralID=" + id); break; case "product": DBCenter.UpdateSQL(TableName, "OrderID=" + order, "ID=" + id); break; case "modelfield": DBCenter.UpdateSQL(TableName, "OrderID=" + order, "FieldID=" + id); break; } } return(Content(Success.ToString())); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Mid > 0) { M_CommonData model = conBll.SelReturnModel(Mid); M_Content conMod = new M_Content(); conMod.id = model.GeneralID; conMod.title = model.Title; conMod.topimg = model.TopImg; DataTable table = SqlHelper.ExecuteTable("SELECT * FROM ZL_C_YJMX WHERE ID=" + model.ItemID); if (table.Rows.Count < 1) { function.WriteErrMsg("游记不存在"); } //if (!string.IsNullOrEmpty(DataConvert.CStr(table.Rows[0]["content"]))) //{ // conMod.comlist = JsonConvert.DeserializeObject<List<M_Component>>(table.Rows[0]["content"].ToString()); //} conMod.mp3 = DataConvert.CStr(table.Rows[0]["music"]); conMod.pic = DataConvert.CStr(table.Rows[0]["pic"]); contStr = table.Rows[0]["content"].ToString(); Save_Hid.Value = JsonConvert.SerializeObject(conMod); } } }
protected void Page_Load(object sender, EventArgs e) { B_User.CheckIsLogged(Request.RawUrl); mu = buser.GetLogin(); if (!IsPostBack) { DataRow dr = ExOrder.SelReturnModel(OrderID); if (dr == null) { function.WriteErrMsg("订单不存在"); } if (DataConvert.CLng(dr["xsrid"]) != mu.UserID) { function.WriteErrMsg("你无权访问该订单"); } if (DataConvert.CLng(dr["status_order"]) != 99) { function.WriteErrMsg("订单不允许评价"); } Title_T.Text = DataConvert.CStr(dr["spmc"]); //订单成功,且未完结,且未评论或最近一次的评论超过(7*24*60),则可评 DataTable shareDT = DBCenter.SelTop(1, "ID", "*", "ZL_Order_Share", "ProID=" + dr["nrgid"] + " AND UserID=" + mu.UserID, "ID DESC"); if (shareDT.Rows.Count > 0) { DateTime last = Convert.ToDateTime(shareDT.Rows[0]["CDate"]); if ((DateTime.Now - last).TotalMinutes < (7 * 24 * 60)) { Save_Btn.Visible = false; tip_div.Visible = true; tip_div.InnerHtml = "你最近一次评论时间:" + last.ToString("yyyy年MM月dd日 HH:mm") + ",必须一周后才可再评论"; } } } }
//根据传参将商品加入购物车后跳转(支持按商品ID,套装ID购买) private void AddToCart(M_UserInfo mu, M_Product proMod, int pronum) { if (pronum < 1) { pronum = 1; } if (proMod == null || proMod.ID < 1) { return; } //商品不存在 if (proMod.ProClass == (int)M_Product.ClassType.IDC) { Response.Redirect("/Cart/FillIDCInfo.aspx?proid=" + proMod.ID); } OrderCommon.ProductCheck(proMod); //-----------------检测完成加入购物车 M_Cart cartMod = new M_Cart(); cartMod.Cartid = CartCookID; cartMod.StoreID = proMod.UserShopID; cartMod.ProID = proMod.ID; cartMod.Pronum = pronum; cartMod.userid = mu.UserID; cartMod.Username = mu.UserName; cartMod.FarePrice = proMod.LinPrice.ToString(); cartMod.ProAttr = DataConvert.CStr(Request["attr"]); cartMod.Proname = proMod.Proname; int id = cartBll.AddModel(cartMod); }
public static string GetFields(DataTable dt, string pk = "id") { string fields = ""; foreach (DataRow dr in dt.Rows) { string field = DataConvert.CStr(dr["FieldName"]); switch (DBCenter.DB.DBType) { case "oracle": fields += WrapField(field) + ","; break; case "mysql": fields += "`" + field + "`,"; break; default: fields += "[" + field + "],"; break; } } fields = fields.TrimEnd(','); return(fields); }
//贴子搜索 public IActionResult PostSearch() { int uid = DataConvert.CLng(RequestEx["uid"]); string skey = DataConvert.CStr(RequestEx["skey"]).Trim(); bool sellike = DataConvert.CLng(RequestEx["islike"]) > 0 ? true : false; string skeyTlp = "\"<span style='color:#ff6a00;'>{0}</span>\""; VM_PClass model = new VM_PClass(); model.cateMod = new M_GuestBookCate(); model.cateMod.BarImage = "/UploadFiles/timg.jpg"; model.setting = barBll.SelPage(CPage, PSize, 0, uid, skey, true); model.setting.url = MVCHelper.GetAction("PostSearch", Request); if (Request.IsAjax()) { return(PartialView("PClass_PostList", model)); } if (!string.IsNullOrEmpty(skey)) { model.cateMod.Desc = "相关" + string.Format(skeyTlp, skey.Replace("|", "、")) + "的贴子"; model.cateMod.CateName = skey + "\"的贴子"; } if (uid > 0) { M_UserInfo smu = buser.GetUserByUserID(uid); model.cateMod.BarImage = smu.UserFace; model.cateMod.CateName = smu.HoneyName + "的贴子"; model.cateMod.Desc = string.Format(skeyTlp, smu.HoneyName) + "的贴子"; } if (sellike) { model.cateMod.CateName = "我的收藏"; model.cateMod.Desc = string.Format(skeyTlp, "我的收藏"); } return(View(model)); }
public static string User_ShowStatus(object status) { string Status = DataConvert.CStr(status); switch (Status) { case "0": return("<span style='color:green;'>正常</span>"); case "1": return("<span style='color:red;'>锁定</span>"); case "2": return("待认证"); case "3": return("双认证"); case "4": return("邮件认证"); case "5": return("待认证"); default: return(Status.ToString()); } }
public string GetRepair(DataRow dr) { string result = ""; if (!OrderHelper.IsFinished(dr, "normal")) { return(result); } //-------------------------------------------- string guess = DataConvert.CStr(dr["GuessXML"]); if (dr["AddStatus"].ToString().Contains("exchange")) { result += "<a href='javascript:;' class='gray9'>已申请换货</a>"; } else if (dr["AddStatus"].ToString().Contains("repair")) { result += "<a href='javascript:;' class='gray9'>已申请返修</a>"; } else if (dr["AddStatus"].ToString().Contains("drawback")) { result += "<a href='javascript:;' class='gray9'>已申请退货</a>"; } else if (!string.IsNullOrEmpty(guess)) { result += "<a href='ReqRepair?cid=" + dr["CartID"] + "' style='color:#015fb6;'>返修/退换货</a>"; } return(result); }
public string Field_API() { string ids = DataConvert.CStr(RequestEx["ids"]); string action = Request.Query["action"]; switch (action) { case "del": { if (!string.IsNullOrEmpty(ids)) { fieldBll.DelByFieldID(ids);; } } break; case "orderup": { M_ModelField curmod = fieldBll.SelReturnModel(DataConverter.CLng(RequestEx["curid"])); curmod.OrderID = DataConverter.CLng(RequestEx["curorder"]); M_ModelField tagmod = fieldBll.SelReturnModel(DataConverter.CLng(RequestEx["tagid"])); tagmod.OrderID = DataConverter.CLng(RequestEx["tagorder"]); fieldBll.UpdateOrder(curmod, tagmod); } break; } return(Success.ToString()); }
/// <summary> /// 拷贝一份至ZL_CartPro长久保存 /// </summary> public void CopyToCartPro(M_UserInfo mu, DataTable dt, int oid) { B_Product proBll = new B_Product(); string[] fields = "Additional,StoreID,AllMoney_Json,code".Split(','); foreach (string field in fields) { if (!dt.Columns.Contains(field)) { dt.Columns.Add(new DataColumn(field, typeof(string))); } } foreach (DataRow dr in dt.Rows) { M_Product proMod = proBll.GetproductByid(Convert.ToInt32(dr["Proid"])); M_CartPro model = new M_CartPro(); model.Orderlistid = oid; model.ProID = proMod.ID; model.Pronum = DataConverter.CLng(dr["Pronum"]); model.Proname = proMod.Proname; model.Shijia = Convert.ToDouble(dr["FarePrice"]); model.Danwei = proMod.ProUnit; model.Addtime = DateTime.Now; model.StoreID = DataConvert.CLng(dr["StoreID"]); model.code = DataConvert.CStr(dr["code"]); model.Attribute = DataConvert.CStr(dr["ProAttr"]); if (!dt.Columns.Contains("AllMoney")) { model.AllMoney = proMod.LinPrice * model.Pronum; } else { model.AllMoney = Convert.ToDouble(dr["AllMoney"]); } //model.Additional = DataConvert.CStr(dr["Additional"]); //model.AllMoney_Json = DataConvert.CStr(dr["AllMoney_Json"]); //如果非促销组合,则不保存商品简介和详情 if (proMod.Class != 2) { proMod.Procontent = ""; proMod.Proinfo = ""; } //原价与优惠信息(便于展示) //model.Usepoint = 0; //model.UsePointArrive = 0; //model.FarePrice = "0"; //model.ArriveMoney = 0; //model.ArriveRemind = ""; #region 保存购买时用户的信息 model.Username = mu.UserName; model.Additional = DataConvert.CStr(dr["Additional"]); //model.Additional = JsonHelper.GetJson(new string[] { "UserID", "GroupID", "PUserID" }, new object[] { mu.UserID, mu.GroupID, mu.ParentUserID }); #endregion #region 将整个商品信息备份(主要是价格和配置部分) model.PClass = proMod.Class.ToString(); //model.ProInfo = JsonConvert.SerializeObject(backup); #endregion model.ID = cartProBll.GetInsert(model); } }
//填充共通部分 private M_CommonData FillContentModel(ref DataTable table, M_CommonData CData, ref string err) { if (CData == null) { CData = new M_CommonData(); } //if (SiteConfig.SiteOption.FileRj == 1 && contentBll.SelHasTitle(RequestEx["txtTitle"])) { WriteErr(Resources.L.该内容标题已存在 + "!", "javascript:history.go(-1);"); } if (CData.GeneralID < 1) { CData.Inputer = adminMod.AdminName; CData.NodeID = NodeID; CData.ModelID = ModelID; CData.TableName = modelBll.SelReturnModel(ModelID).TableName; string parentTree = ""; CData.FirstNodeID = nodeBll.SelFirstNodeID(CData.NodeID, ref parentTree); CData.ParentTree = parentTree; } DataTable dt = fieldBll.SelByModelID(CData.ModelID, false); try { table = Call.GetDTFromMVC(dt, Request); } catch (Exception ex) { err = ex.Message; return(null); } CData.Title = RequestEx["txtTitle"]; CData.EliteLevel = DataConvert.CLng(RequestEx["EliteLevel"]); CData.Hits = DataConvert.CLng(RequestEx["Hits"]); CData.TagKey = RequestEx["tabinput"]; CData.Status = DataConvert.CLng(RequestEx["ddlFlow"]); CData.Template = RequestEx["TemplateUrl_hid"]; CData.CreateTime = DataConverter.CDate(RequestEx["CreateTime"]); CData.UpDateTime = DataConverter.CDate(RequestEx["UpDateTime"]); CData.SpecialID = "," + string.Join(",", DataConvert.CStr(RequestEx["Spec_Hid"]).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + ","; CData.TitleStyle = RequestEx["ThreadStyle"]; CData.TopImg = RequestEx["ThumImg_Hid"];//首页图片 CData.Subtitle = RequestEx["Subtitle"]; CData.PYtitle = RequestEx["PYtitle"]; CData.RelatedIDS = RequestEx["RelatedIDS_Hid"]; CData.IsComm = DataConvert.CLng(RequestEx["IsComm_Radio"]); CData.UGroupAuth = RequestEx["UGroupAuth"]; CData.IsTop = DataConvert.CLng(RequestEx["IsTop"]); CData.IsTopTime = DataConvert.CStr(RequestEx["IsTopTime"]); #region 关键词 { B_KeyWord keyBll = new B_KeyWord(); string[] ignores = DataConvert.CStr(RequestEx["Keywords"]).Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string[] newKeys = CData.TagKey.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string keys = StrHelper.RemoveRepeat(newKeys, ignores); if (!string.IsNullOrEmpty(keys)) { keyBll.AddKeyWord(keys, 1); } } #endregion return(CData); }
public MvcHtmlString GetSubTitle(DataRow dr) { if (DataConvert.CLng(dr["C_Status"]) == 3 && DataConvert.CLng(dr["Status"]) < 1) { return(MvcHtmlString.Create("")); } return(MvcHtmlString.Create(DataConvert.CStr(dr["SubTitle"]))); }
//替换模板中的值 private string TlpDeal(string tlp, DataRow dr) { foreach (DataColumn dc in dr.Table.Columns) { tlp = tlp.Replace("@" + dc.ColumnName, DataConvert.CStr(dr[dc.ColumnName])); } return(tlp); }
protected void Photo_Btn_Click(object sender, EventArgs e) { PageSetting setting = PageSetting.Single(1, int.MaxValue, "PE_Photo", "PhotoID", ""); DataTable dt = access.SelPage(setting); M_ModelInfo modMod = modBll.SelReturnModel(3); //PE_Article,PE_Announce,PE_Class //节点--内容--用户 dt.Columns["PhotoName"].ColumnName = "Title"; dt.Columns["Inputer"].ColumnName = "Inputer";//添加人,有很多null值,需要做null判断 dt.Columns["CreateTime"].ColumnName = "CreateTime"; dt.Columns["UpDateTime"].ColumnName = "UpDateTime"; dt.Columns["ClassID"].ColumnName = "NodeID"; dt.Columns["PhotoID"].ColumnName = "ArticleID";;//来源ID,用于后期还有数据需要对比获取 dt.Columns.Add(new DataColumn("ModelID", typeof(int))); dt.Columns.Add(new DataColumn("TableName", typeof(string))); if (!dt.Columns.Contains("Status")) { dt.Columns.Add(new DataColumn("Status", typeof(int))); } dt.Columns.Add(new DataColumn("ItemID", typeof(int))); //读返回值 dt.Columns["Hits"].ColumnName = "Hits"; dt.Columns["PhotoThumb"].ColumnName = "TopImg"; //预览图 //---------从表数据 //图片地址3|200710/20071016163946346.jpg$$$图片地址2|200710/20071016164226965.jpg$$$图片地址3|200710/20071016164226498.jpg$$$图片地址4|201006/20100604112746823.jpg //[{"url":"http://www.z01.com/skin/default/productshow1.jpg","desc":"产品展示1"},{"url":"https://www.z01.com/skin/default/productshow2.jpg","desc":"产品展示2"},{"url":"https://www.z01.com/skin/default/productshow3.jpg","desc":"产品展示3"},{"url":"https://www.z01.com/skin/default/productshow4.jpg","desc":"产品展示4"},{"url":"https://www.z01.com/skin/default/productshow5.jpg","desc":"产品展示5"}] dt.Columns["PhotoUrl"].ColumnName = "PhotoUrl"; dt.Columns["Author"].ColumnName = "author"; //实际作者 dt.Columns["PhotoIntro"].ColumnName = "content"; //简介 dt.Columns["CopyFrom"].ColumnName = "source"; //c for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; dr["ModelID"] = modMod.ModelID; dr["TableName"] = modMod.TableName; dr["ItemID"] = 0; dr["Status"] = 99; if (string.IsNullOrEmpty(DataConvert.CStr(dr["Inputer"]))) { dr["Inputer"] = "empty"; } string[] pics = Regex.Split(DataConvert.CStr(dr["PhotoUrl"]), Regex.Escape("$$$")); string pic_result = ""; foreach (string pic in pics) { string desc = pic.Split('|')[0]; string url = "Photo/" + pic.Split('|')[1]; pic_result += "{\"url\":\"" + url + "\",\"desc\":\"" + desc + "\"},"; } pic_result = "[" + pic_result.Trim(',') + "]"; dr["PhotoUrl"] = pic_result; } //与数据库大小写必须一致 string[] mfields = "Title|Inputer|CreateTime|UpDateTime|NodeID|ModelID|TableName|Status|ItemID|Hits|ArticleID".Split('|'); string[] subfields = "author|source|ArticleID|content|PhotoUrl".Split('|'); CopyArticle(dt, mfields, modMod.TableName, subfields); }
protected void Article_Btn_Click(object sender, EventArgs e) { PageSetting setting = PageSetting.Single(1, int.MaxValue, "PE_Article", "ArticleID", ""); DataTable dt = access.SelPage(setting); M_ModelInfo modMod = modBll.SelReturnModel(2); //PE_Article,PE_Announce,PE_Class //节点--内容--用户 dt.Columns["Title"].ColumnName = "Title"; dt.Columns["Inputer"].ColumnName = "Inputer";//添加人,有很多null值,需要做null判断 dt.Columns["CreateTime"].ColumnName = "CreateTime"; dt.Columns["UpDateTime"].ColumnName = "UpDateTime"; dt.Columns["ClassID"].ColumnName = "NodeID"; dt.Columns["ArticleID"].ColumnName = "ArticleID";;//来源ID,用于后期还有数据需要对比获取 dt.Columns.Add(new DataColumn("ModelID", typeof(int))); dt.Columns.Add(new DataColumn("TableName", typeof(string))); if (!dt.Columns.Contains("Status")) { dt.Columns.Add(new DataColumn("Status", typeof(int))); } dt.Columns.Add(new DataColumn("ItemID", typeof(int))); //读返回值 dt.Columns["Hits"].ColumnName = "Hits"; dt.Columns["DefaultPicUrl"].ColumnName = "TopImg"; //预览图 //---------从表数据 dt.Columns["Content"].ColumnName = "content"; dt.Columns["UploadFiles"].ColumnName = "uploadfiles"; //上传文件(需要关联字段) dt.Columns["Author"].ColumnName = "author"; //实际作者 dt.Columns["Intro"].ColumnName = "synopsis"; //简介 dt.Columns["CopyFrom"].ColumnName = "source"; //c for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; dr["ModelID"] = modMod.ModelID; dr["TableName"] = modMod.TableName; dr["ItemID"] = 0; dr["Status"] = 99; if (string.IsNullOrEmpty(DataConvert.CStr(dr["Inputer"]))) { dr["Inputer"] = "empty"; } string[] pics = DataConvert.CStr(dr["UploadFiles"]).Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (pics.Length > 0) { string pic_result = ""; foreach (string pic in pics) { pic_result += "{\"url\":\"Article/" + pic + "\",\"desc\":\"\"},"; } pic_result = "[" + pic_result.Trim(',') + "]"; dr["UploadFiles"] = pic_result; } } //与数据库大小写必须一致 string[] mfields = "Title|Inputer|CreateTime|UpDateTime|NodeID|ModelID|TableName|Status|ItemID|TopImg|Hits|ArticleID".Split('|'); string[] subfields = "author|content|source|ArticleID|synopsis|uploadfiles".Split('|'); CopyArticle(dt, mfields, modMod.TableName, subfields); }
protected void Page_Load(object sender, EventArgs e) { M_UserInfo mu = GetLogin(); if (!IsPostBack) { ProModel model = new ProModel() { ProID = DataConvert.CLng(Request["ID"]), Pronum = DataConvert.CLng(Request["Pronum"]) }; model.Pronum = model.Pronum < 1 ? 1 : model.Pronum; if (model.ProID > 0)//将商品加入购物车 { M_Product proMod = proBll.GetproductByid(model.ProID); if (proMod == null || proMod.ID < 1) { function.WriteErrMsg("商品不存在"); } if (proMod.ProClass == (int)M_Product.ClassType.IDC) { Response.Redirect("/Cart/FillIDCInfo.aspx?proid=" + proMod.ID); } OrderCommon.ProductCheck(proMod); #region 特选商品逻辑 [delete] if (proMod.Largess == 1) { B_User_BindPro ubpBll = new B_User_BindPro(); M_User_BindPro ubpMod = null; if (mu.IsNull) { return; } ubpMod = ubpBll.SelModelByUid(mu.UserID); if (ubpMod == null || !ubpMod.ProIDS.Contains("," + proMod.ID + ",")) { Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); return; } } #endregion //-----------------检测完成加入购物车 M_Cart cartMod = new M_Cart(); cartMod.Cartid = CartCookID; cartMod.StoreID = proMod.UserShopID; cartMod.ProID = model.ProID; cartMod.Pronum = model.Pronum; cartMod.userid = mu.UserID; cartMod.Username = mu.UserName; cartMod.FarePrice = proMod.LinPrice.ToString(); cartMod.ProAttr = DataConvert.CStr(Request["attr"]); cartMod.Proname = proMod.Proname; int id = cartBll.AddModel(cartMod); //ImportExtField(id, Request.Form["ext_hid"]);//模型字段 Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); } MyBind(); } }
protected void Pro_RPT_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { //如果变复杂,将其分离为局部页 if (e.Item.ItemIndex == 0)//首行判断 { DataRowView dr = e.Item.DataItem as DataRowView; M_Payment payMod = OrderHelper.GetPaymentByOrderNo(dr.Row); int count = OrderDT.Select("id=" + dr["ID"]).Length; string html = ""; //收货人 html += "<td class='td_l rowtd' rowspan='" + count + "'>"; html += "<i class='fa fa-user'></i> <a href='OrderList.aspx?UserID=" + dr["UserID"] + "' title='按用户筛选'>" + B_User.GetUserName(dr["HoneyName"], dr["AddUser"]) + "</a>"; html += "(<a href='javascript:;' onclick='user.showuinfo(" + dr["UserID"] + ");' title='查看用户信息'><span style='color:green;'>" + dr["UserID"] + "</span></a>)"; html += "</td>"; //金额栏 html += "<td class='td_l rowtd' rowspan='" + count + "' style='font-size:12px;'>总计:<i class='fa fa-rmb'></i> " + Convert.ToDouble(dr["OrdersAmount"]).ToString("f2") + "<br />"; string _paytypeHtml = OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.PayType); if (!string.IsNullOrEmpty(_paytypeHtml)) { _paytypeHtml = _paytypeHtml + "<br />"; } html += _paytypeHtml; html += "<div>商品:" + (DataConvert.CDouble(dr["OrdersAmount"]) - DataConvert.CDouble(dr["Freight"])).ToString("F2") + "</div>"; html += "<div>运费:" + DataConvert.CDouble(dr["Freight"]).ToString("F2") + "</div>"; html += "<div title='优惠卷'>优惠:" + payMod.ArriveMoney.ToString("F2") + "</div>"; html += "<div>积分:" + payMod.UsePointArrive.ToString("f2") + "(" + payMod.UsePoint.ToString("F0") + ")</div>"; html += "<div style='color:#d9534f;'>需付:" + payMod.MoneyReal.ToString("F2") + "</div>"; if (!string.IsNullOrEmpty(DataConvert.CStr(dr["PaymentNo"]))) { string plat = platBll.GetPayPlatName(DataConvert.CStr(dr["PaymentNo"])); html += "<a href='" + StrHelper.Url_AddParam(Request.RawUrl, "filter=paid") + "' title='筛选已付款订单'>" + "<span style='color:#337ab7;'>" + plat + "</span>" + "(" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Pay) + ")</a>"; } else { html += "(" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Pay) + ")"; } html += "</td>"; //订单状态 html += "<td class='td_md rowtd' rowspan='" + count + "'><span class='gray9'>" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Order) + "</span> <br />"; int ordertype = DataConvert.CLng(dr["OrderType"]); //非旅游与酒店订单,则显示快递信息 int expid = DataConvert.CLng(dr["ExpressNum"]); if (ordertype != 7 && ordertype != 9) { html += "<a href='javascript:;' class='expview_a' data-expid='" + expid + "' id='expview_" + dr["ID"] + "_a' onclick=\"exp.apilink(this,'" + expid + "');\">" + OrderHelper.GetExpStatus(Convert.ToInt32(dr["StateLogistics"])) + "</span> <br/>"; } html += "</td>"; //操作栏 html += "<td class='td_md rowtd' rowspan='" + count + "'><a href='OrderListInfo.aspx?ID=" + dr["ID"] + "' class='order_bspan'>订单详情</a><br/>" + Getoperator(dr) + "</td>"; (e.Item.FindControl("Order_Lit") as Literal).Text = html; } } }
private DataTable MyBind(int psize, int cpage) { PageSetting setting = stBll.SelPage(cpage, psize, new Com_Filter() { skey = skey_t.Text.Trim(), status = DataConvert.CStr(Request["status"]) }); RPT.ItemCount = setting.itemCount; return(setting.dt); }