<%@ WebHandler Language="C#" Class="NSW.Web.Ajax" %> #region namspace using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using NSW.Entities; using System.Data; using BlueCrystal.Data; using System.Xml; using NSW.Utls; using System.Text.RegularExpressions; #endregion #region 程序著作权以及用途 /********************************************************************** * 程序作者:李剑飞、戴颜青 * 电子邮件:masterlijf@hotmail.com, likecode#qq.com * 公司名称:深圳市牛商网络有限公司 * 程序书写时间:2009-2-26 * 程序实现目的: * 1. 前台程序AJAX服务端代码 **********************************************************************/ #endregion; namespace NSW.Web { public class Ajax : IHttpHandler, System.Web.SessionState.IRequiresSessionState { public void ProcessRequest(HttpContext context) { //操作 string action = context.Request.QueryString["action"]; //检查来源 if (!ComUtls.CheckPostSource()) { context.Response.Write(ORes.Error.SuspiciousOfPostingSourceAndBeIgnored); return; } /**************************************** * 加快方法调用响应速度,所有方法和属性尽量以静态的形式实现 ***************************************/ switch (action) { //初始化通用头部热门关键词信息 case "initcommonheaderkeywords": InitCommonHeaderKeywords(); break; //自增点击率 case "hits": Hits(); break; // 帮助中心满意度(帮助作用)反馈 case "helpuseful": HelpUseful(); break; //获得产品的简单介绍(横排预览) case "showProductInfo": ShowProductInfo(); break; //获得产品的简单介绍(竖排预览) case "showProductInfos": ShowProductInfos(); break; //帮助中心满意度 case "helpsatisfaction": HelpSatisfaction(); break; //显示套餐中的产品价格 case "getTaoCanPrice": GetTaoCanPrice(); break; //产品对比车 case "addCompare": AddCompare(); break; //移除某个对比车中的产品 case "delOneCompare": DelOneCompare(); break; //移除所有对比车中的产品 case "delAllCompare": DelAllCompare(); break; //发表评论 case "postcomment": PostComment(); break; //产品预定 case "postProductTips":PostProductTips();break; //产品预览中的愿望夹 case "showMyWish": ShowMyWish(); break; //产品预览保存到愿望夹 case "postProductWishs": PostProductWishs(); break; //读取置顶属性的属性值对应的图片 case "attrValuesPhotos": GetAttrValuesPhotos(); break; //添加产品到购物车 case "addtocart": AddToCart(); break; //删除产品到购物车 case "deltocart": DelToCart(); break; //清空购物车 case "emptycart": EmptyCart(); break; //检查电子邮箱地址是否已注册 case "checkemail": CheckEmail(); break; //检查用户名是否已注册 case "checkusername": CheckUsername(); break; //注册会员 case "register": Register(); break; //初始化通用头部信息 case "initcommonheader": InitCommonHeader(); break; //取消订单 case "cancelorder": CancelOrder(); break; //获取登陆会员的信息 case "setUserInfo": SetUserInfo(); break; //删除收藏夹分类 case "delfavfolumn": DelFavColumn(); break; //添加收藏 case "fav": AddFav(); break; //删除收藏 case "delfav": DelFav(); break; //删除愿望夹 case "delMyWishs": DelMyWishs(); break; //删除下载记录 case "delMyDownloads": DelMyDownloads(); break; //获取评论 case "getcomment": GetComment(); break; //添加浏览历史 case "addhistory": AddHistory(); break; //获取广告代码 case "getadd": GetAd(); break; //获取视频代码 case "getvideo": GetVideo(); break; //获取收货评语 case "getendingremark": GetEndingRemark(); break; //获取订单公告 case "getorderanns": GetOrderAnnouncement(); break; //获取浏览历史 case "gethistory": GetHistory(); break; //获取对象点击率 case "gethits": GetHits(); break; //获取相关文章 case "getsmilararticle": GetSimilarArticle(); break; //获取最新发布的文章 case "getlastarticle": GetLastArticle(); break; //删除浏览历史 case "cleanhistory": CleanHistory(); break; //邮件订阅 case "subscription": Subscription(); break; //会员反馈/意见 case "userfeedback": UserFeedback(); break; //检查权限 case "checkauthority": CheckAuthority(); break; //更新收藏夹分类 case "changefavcolumn": ChangeFavColumn(); break; //更新收藏夹分类 case "GetRecommentProductByHistory": GetRecommentProductByHistory(); break; //根据浏览历史推荐方案服务 case "GetRecommentProjectByHistory": GetRecommentProjectByHistory(); break; //购买过某样产品的人还购物过的产品 case "GetRelevantSales": GetRelevantSales(); break; //浏览过此产品的人还浏览过 case "GetRelevantViewed": GetRelevantViewed(); break; //浏览过此下载信息的人还浏览过 case "GetRelevantViewedDownload": GetRelevantViewedDownload(); break; //浏览过此方案服务的人还浏览过 case "GetRelevantViewedProject": GetRelevantViewedProject(); break; //删除邀请函日志 case "DelInitationlog": DelInitationlog(); break; //发送邀请注册函 case "SendInvitation": SendInvitation(); break; //动态表单收集用户信息 case "CollectionUserInfo": CollectionUserInfo(); break; //动态表单收集用户信息 case "Survey": Survey(); break; //获取报告分类 case "GetReportCategories": GetReportCategories(); break; //获取留言分类 case "GetLeavewordCategories": GetLeavewordCategories(); break; //发送报告 case "SendReports": SendReports(); break; //发送留言 case "SendLeaveword": SendLeaveword(); break; //发送留言 case "SendLeaveword01": SendLeaveword01(); break; //直接付款 case "DirectPay": DirectPay(); break; //采购 case "submitorder": SubmitOrder(); break; //加盟商在线下单 case "sendGetProductsByColumn": SendGetProductsByColumn(); break; //用户登录 case "logincheck": LoginCheck(); break; #region ********************* 代理加盟 ************************** //招商加盟满意度(帮助作用)反馈 case "agenthelpuseful": AgentHelpUseful(); break; //招商加盟满意度 case "agenthelpsatisfaction": AgentHelpSatisfaction(); break; //加盟商意向定单 case "agentorder": AgentOrder(); break; //删除代理商的定单 case "delAgentOrder": DelAgentOrder(); break; //申请友情连接 case "apply": AddApply(); break; #endregion #region *********************下载中心 ************************** //添加下载日志 case "addDownload": AddDownload(); break; #endregion case "SendDownLeaveword": SendDownLeaveword(); break; default: WriteString("Invalid request。"); break; } } /// /// 发送留言 /// private static void SendDownLeaveword() { // 获取参数 string title = ""; // string compName =""; string cat = ""; string contact = ClearGF("name"); string email =""; string shortDesc ="公司名:" + ClearGF("cmy"); string tel = ""; string mobile = ClearGF("mobile"); //安全检查 SecurityCheck(null, CheckingType.BlockToSubmitIPs, CheckingType.ForbiddenIP, CheckingType.GlobalSubmittingFrequency); //保存记录 tbLeaveword nobj = new tbLeaveword(); nobj.Category = cat; nobj.Contact = contact; nobj.Content = shortDesc; nobj.Email = email; nobj.Enable = false; nobj.InputTime = DateTime.Now; nobj.IP = IP; nobj.MobileNo = mobile; nobj.OrderID = 50; nobj.TelNo = tel; nobj.Country=""; nobj.Title = "下载留言"; int rowsAffected = DbSession.Default.Save(nobj); //回应 if (rowsAffected > 0) { //更新最后提交时间 OSession.Common.LastPost = DateTime.Now; WriteState(1, "Thank you for your comments, we will do better with your support."); } else { WriteState(0, "Sorry, failed to submit. Please try again later."); } } /// /// 获取会员登录后的基本信息 /// private static void SetUserInfo() { if (!BLL.Mem.CheckPassport()) { KeyValuePair node; KeyValuePair node2; node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "You are not currently Sign in or you are not currently a member"); WriteXml(node, node2); return; } else { KeyValuePair node; KeyValuePair node1; KeyValuePair node2; KeyValuePair node3; KeyValuePair node4; KeyValuePair node5; KeyValuePair node6; KeyValuePair node7; node = new KeyValuePair("state", "1"); node1 = new KeyValuePair("ChnName", OSession.Mem.User.ChnName); node2 = new KeyValuePair("Phone", OSession.Mem.User.Phone); node3 = new KeyValuePair("Email", OSession.Mem.User.UserEmail); node4 = new KeyValuePair("MPhone", OSession.Mem.User.MPhone); node5 = new KeyValuePair("CompName", OSession.Mem.User.CompName); node6 = new KeyValuePair("Address", OSession.Mem.User.Address); node7 = new KeyValuePair("Province", OSession.Mem.User.Province); WriteXml(node,node1, node2, node3, node4, node5, node6, node7); return; } } /// /// 添加下载日志 /// private static void AddDownload() { //1 获取参数 int oid = ComUtls.ParseInt(GF("oid"), -1); KeyValuePair node; KeyValuePair node2; VW_Download OBJ = DbSession.Default.Get(VW_Download._.ID == oid); if (OBJ==null) { node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "This record does not exist!"); WriteXml(node, node2); return; } //判断文件下载人的权限范围,为空表示不限制任何人下载 if (OBJ.Authority == "") { node = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", "This file is downloadable for everyone!"); WriteXml(node, node2); return; } else//需要是会员 { //判断是否登录 if (!BLL.Mem.CheckPassport()) { node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "You are not currently Sign in or you are not currently a member, thus you cannot download this resource。
Please log in or register。"); WriteXml(node, node2); return; } //判断是会员,也是否享有会员间的区别权限 if(BLL.Mem.CheckAuthority(OBJ.Authority)==false) { node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "Sorry, you do not have the permission to download this resource!"); WriteXml(node, node2); return; } else { //检查是否有下过此资源的历史记录 VW_DownloadLog VW_DL = DbSession.Default.Get(VW_DownloadLog._.DownloadID == oid&&VW_DownloadLog._.UserID==OSession.Mem.ID); if(VW_DL!=null) { node = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", "This resource can be downloaded again!"); WriteXml(node, node2); return; } //检查下载文件的积分是否够用 if (OSession.Mem.Wealth < OBJ.Point) { node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "Sorry, you do not have enough credits. To download this resource, "+ OBJ.Point.ToString() + " credits are required. "); WriteXml(node, node2); return; } //初始化下载资源对象 tbDownloadLog DownloadLog = new tbDownloadLog(); DownloadLog.DownloadID = oid; DownloadLog.DownloadURL = ""; DownloadLog.Enable = false; DownloadLog.InputTime = DateTime.Now; DownloadLog.UserID = OSession.Mem.ID; DownloadLog.OrderID = 50; //插入记录 int rowsAffected = DbSession.Default.Save(DownloadLog); if (rowsAffected > 0) { //如果插入成功,消耗积分和反馈积分给用户 int mark = OSession.Mem.Wealth + OBJ.ReturnPoint - OBJ.Point; string cmdText = string.Format("UPDATE tbUser SET UserWealth={0} WHERE [ID]={1}", mark, OSession.Mem.ID); rowsAffected = DbSession.Default.Excute(cmdText); node = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", "Download record is successfully inserted!"); WriteXml(node, node2); return; } else { node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "Exception in the download, please try again later!"); WriteXml(node, node2); return; } } } } /// /// 浏览过此方案服务的人还浏览过 /// private static void GetRelevantViewedProject() { //1 获取参数 int srcProdId = ComUtls.ParseInt(GF("oid"), -1); //2 从DB获取数据 Field[] nfields = new Field[]{ VW_Project._.Title, VW_Project._.PhotoPath, VW_Project._.PageURL, VW_Project._.ID, VW_Project._.ShortDesc }; DataTable dt = BLL.Project.GetRelevantViewed(srcProdId, nfields, 3); if (dt.Rows.Count == 0) { return; } //3 根据模板生成HTML代码 string template = "<$Foreach$>
" + "
\"{$Title$}\"
" + "
{$Title$}
" + "
{$ShortDesc$}
" + "
<$EndForeach$>"; //4 回应 WriteString(BLL.Template.ProcessTemplate(template, dt)); } /// /// 用户登录 /// private static void LoginCheck() { string username = GF("username").Trim(); string pin = GF("password").Trim(); KeyValuePair node; KeyValuePair node2; OEnum.Mem.LogingInResult result = BLL.Mem.Login(username, pin, DateTime.Now, IP); switch (result) { case NSW.OEnum.Mem.LogingInResult.Disabled: node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "This username has not yet been activated, please activate your account before login"); WriteXml(node, node2); break; case NSW.OEnum.Mem.LogingInResult.Falied: node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "Login failed, please try again later"); WriteXml(node, node2); break; case NSW.OEnum.Mem.LogingInResult.IncorrectPin: node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "Incorrect username or password, please check and try again later"); WriteXml(node, node2); break; case NSW.OEnum.Mem.LogingInResult.NonVerified: node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "An account needs to be activated for new records, please check your E-mail and activate your account"); WriteXml(node, node2); break; case NSW.OEnum.Mem.LogingInResult.NonVerifiedEmail: node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "This mailbox has been used by a registered user"); WriteXml(node, node2); break; case NSW.OEnum.Mem.LogingInResult.Successful: node = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", "Successful login, welcome"); WriteXml(node, node2); break; case NSW.OEnum.Mem.LogingInResult.UserNotExists: node = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "This user does not exist, please double check"); WriteXml(node, node2); break; default: break; } } /// /// 初始化通用头部热门关键词信息 /// private static void InitCommonHeaderKeywords() { string s = GF("s").Trim(); //关键词 WriteString(_Tools.InitCommonHeaderKeywords(s)); } /// ///填加一个友情连接 /// private static void AddApply() { string Type = GF("Type"); string Url = GF("Url"); string Name = GF("Name"); string PhotoPath = GF("PhotoPath"); string Content = GF("Content"); string UserName = GF("UserName"); string Phone = GF("Phone"); string Email = GF("Email"); string QQ = GF("QQ"); tbApply Obj = new tbApply(); Obj.Type = int.Parse(Type); Obj.Url = Url; Obj.Name = Name; Obj.PhotoPath = PhotoPath; Obj.Content = Content; Obj.UserName = UserName; Obj.Phone = Phone; Obj.Email = Email; Obj.QQ = QQ; Obj.State = 0; Obj.InputTime = DateTime.Now; int rowsAffected = DbSession.Default.Save(Obj); if (rowsAffected > 0) { KeyValuePair node1 = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("msg", "Application for links is successfully submitted, please wait for the reply from administrator!"); WriteXml(node1, node2); } else { KeyValuePair node1 = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Failed to submit the application for links, please try again later!"); WriteXml(node1, node2); } } /// /// 处理产品的对比车(产品是不同类别) /// private static void AddCompare() { string ids = GF("ids"); string flag = GF("flag"); string cookie = OCookie.Mem.ProductCompare; string [] arrcookie = cookie.Split(','); string newcookie = string.Empty; if (cookie == "") { newcookie = ids; } else { //添加 if (flag == "true") { bool res = false; foreach (string obj in arrcookie) { if (obj == ids) { res = true; } else { if (newcookie == "") { newcookie += obj; } else { newcookie += "," + obj; } } } if (res ==true) { newcookie = newcookie+","+ids; } else { newcookie = cookie + "," + ids; } } else//删除 { foreach (string obj in arrcookie) { if (obj != ids) { if(newcookie=="") { newcookie += obj; } else { newcookie +="," +obj; } } } } } OCookie.Mem.ProductCompare = newcookie; KeyValuePair node3 = new KeyValuePair("state", "1"); KeyValuePair node4 = new KeyValuePair("newcookie", newcookie); WriteXml(node3, node4); } /// /// 移除产品的对比车中的某个产品(产品是不同类别) /// private static void DelOneCompare() { string ids = GF("ids"); string cookie = OCookie.Mem.ProductCompare; string[] arrcookie = cookie.Split(','); string newcookie = string.Empty; if (cookie == "") { newcookie = ""; } else { foreach (string obj in arrcookie) { if (obj != ids) { if (newcookie == "") { newcookie += obj; } else { newcookie += "," + obj; } } } } OCookie.Mem.ProductCompare = newcookie; if (newcookie=="") { KeyValuePair node1 = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("newcookie", "Product record does not exist"); WriteXml(node1, node2); } else { KeyValuePair node1 = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("newcookie", "Successfully removed"); WriteXml(node1, node2); } } /// /// 移除产品的对比车中的所有产品(产品是不同类别) /// private static void DelAllCompare() { OCookie.Mem.ProductCompare = null; KeyValuePair node1 = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("newcookie", "Successfully removed"); WriteXml(node1, node2); } /// /// 删除代理商的定单 /// private static void DelAgentOrder() { if (!BLL.Mem.CheckPassport()) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "You are not currently Sign in or you are not currently a member, thus order management function is not available. Please log in or register
Please log in or register."); WriteXml(node, node2); return; } //1 获取参数 string ids = GF("ids"); if (ids.IndexOf("on") != -1 && ids.Split(',').Length == 1) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "No order record, no need to delete."); WriteXml(node, node2); return; } else { ids = ids.Replace("on,",""); } //2 检查参数 if (!ComUtls.CheckIDsFormat(ids)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Parameter error: ids"); WriteXml(node, node2); return; } //3 查询数据库 WhereClip nwhere = (tbAgentOrder._.ID.In(ids.Split(',')) && tbAgentOrder._.UserID == OSession.Mem.ID); int rowsAffected = DbSession.Default.Delete(nwhere); //4 回应 if (rowsAffected > 0) { KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("The franchisee order is successfully deleted, and {0} records are deleted in total。", rowsAffected)); WriteXml(node, node2); return; } else { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Failed to delete the franchisee order. Please try again later."); WriteXml(node, node2); return; } } /// /// 加盟在线下单 /// private static void AgentOrder() { //1> 获取参数 KeyValuePair node1; KeyValuePair node2; string name = GF("s_name"); string title = GF("s_title"); string tel = GF("s_tel"); string email = GF("s_email"); string content = GF("s_content"); string address = GF("s_address"); string enddate = GF("s_enddate"); string s_IDList = GF("s_IDList"); bool isLogin = BLL.Mem.CheckPassport(); tbUser objUser = OSession.Mem.User; if (objUser.UserGroupID != 5) { node1 = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "Sorry, you are not currently an agent, thus you do not have the permission to place an order here."); WriteXml(node1, node2); return; } tbAgentOrder ObjUserOrder = new tbAgentOrder(); ObjUserOrder.UserID = objUser.ID; ObjUserOrder.ProductList = s_IDList; ObjUserOrder.Title = title; ObjUserOrder.Name = name; ObjUserOrder.Phone = tel; ObjUserOrder.Address = address; ObjUserOrder.Email = email; ObjUserOrder.FeedBack = ""; ObjUserOrder.EndDate = Convert.ToDateTime(enddate); ObjUserOrder.InputTime = DateTime.Now; ObjUserOrder.Content = content; ObjUserOrder.PostState = 0; ObjUserOrder.ReceiveState = 0; //保存到数据库 int rowsAffected = DbSession.Default.Save(ObjUserOrder); //显示提示 if (rowsAffected > 0) { node1 = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", "The order is successfully submitted, and we will contact you as soon as possible, thank you!"); WriteXml(node1, node2); } else { node1 = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "Failed to submit the order. Please try again later!"); WriteXml(node1, node2); // WriteString("0"); } } /// /// 发送获取资讯列表通知 /// private static void SendGetProductsByColumn() { //1\定义变量 string ColumnID, SearchText; string ResultString = ""; //2\获取产品数据列表 ColumnID = GF("columnid"); SearchText = GF("searchtext"); WhereClip nwhere; //3\绑定数据 if (SearchText.Length > 0) { nwhere = (VW_Product._.sid.Like(ColumnID + "%") && VW_Product._.Title.Like("%" + SearchText + "%") && VW_Product._.Enable == true); } else { nwhere = (VW_Product._.sid.Like(ColumnID + "%") && VW_Product._.Enable == true); } Field[] nfields = new Field[] { VW_Product._.ID, VW_Product._.Title }; DataTable dt = DbSession.Default.From().Select(nfields).Where(nwhere).ToDataTable(1000); foreach (DataRow dr in dt.Rows) { ResultString += dr[VW_Product._.ID.Name].ToString() + "$$" + dr[VW_Product._.Title.Name].ToString().Replace("$$", "").Replace("||", ""); ResultString += "||"; } //4\结束 WriteString(ResultString); } private static void SubmitOrder() { KeyValuePair node1; KeyValuePair node2; //1 获取参数 int oid = ComUtls.ParseInt(GF("oid"), -1); string contact = HttpUtility.HtmlEncode(GF("contact").Trim()); string compName = HttpUtility.HtmlEncode(GF("compName").Trim()); string tel = HttpUtility.HtmlEncode(GF("tel").Trim()); string mobile = HttpUtility.HtmlEncode(GF("mobile").Trim()); string email = HttpUtility.HtmlEncode(GF("email").Trim()); string addr = HttpUtility.HtmlEncode(GF("addr").Trim()); string country = HttpUtility.HtmlEncode(GF("country").Trim()); string content = HttpUtility.HtmlEncode(GF("content").Trim()); string vali = HttpUtility.HtmlEncode(GF("vali").Trim()); //2 检查参数 //获取订单号 string orderSnPrefix = "P"; string orderSn = BLL.Order.GetOrderSn(orderSnPrefix); //开始进行订单创建事务 DbTran dbTran = DbSession.Default.BeginTran(); try { //4 填充实体 DateTime nowTime = DateTime.Now; tbOrder orderObj = new tbOrder(); orderObj.ActConsumePoint = 0; orderObj.ActDeliveryFee = 0; orderObj.ActDeliveryMethod = 0; orderObj.ActGoodsAccount = 0; orderObj.ActOrderAccount = 0; orderObj.ActPayMethod = 0; orderObj.ActReturnPoint = 0; orderObj.ConsumePoint = 0; orderObj.DeliveryFee = 0; orderObj.DeliveryState = (int)OEnum.DeliveryState.正在审核1; orderObj.Enable = true; orderObj.EndingColumn = -1; orderObj.EndingRemark = string.Empty; orderObj.GoodsAccount = 0; orderObj.InputTime = nowTime; orderObj.isLock = false; orderObj.OrderAccount = 0; orderObj.OrderNo = orderSn; orderObj.OrderState = (int)OEnum.OrderState.待审核1; orderObj.PayMethod = 0; orderObj.PayState = (int)OEnum.PaymentState.未付款2; orderObj.ReturnPoint = 0; orderObj.UserName = OSession.Mem.Username; //收货人信息 orderObj.UserRemark = "Company name:" + compName + ";\r\ndescription on purchase intention:" + content; orderObj.ZipCode = string.Empty; orderObj.Province = country; orderObj.Phone = tel; orderObj.ChnName = contact; orderObj.Address = addr; orderObj.City = string.Empty; orderObj.Email = email; orderObj.InvoiceTitle = string.Empty; orderObj.MPhone = mobile; orderObj.NeedInvoice = false; //其它 orderObj.AdminRemark = string.Empty; orderObj.DomainName = string.Empty; orderObj.EKN = string.Empty; orderObj.ESN = string.Empty; orderObj.EUN = string.Empty; orderObj.ActTaxAccount = 0; orderObj.TaxAccount = 0; //优惠券 orderObj.CardNo = string.Empty; int rowsAfffected = dbTran.Save(orderObj); if (rowsAfffected < 1) { //ShowMsgBox("", NSW.OEnum.Common.MessageType.Information); //return; throw new Exception("Failed to save the order. Please try again later."); } //保存订单产品信息 VW_Product objProd = DbSession.Default.Get(VW_Product._.ID == oid); if (objProd == null) { throw new Exception("The product does not exist."); } //获取相关参数 int pid = objProd.ID; string title = objProd.Title; decimal price = 0; decimal closingPrice = 0; //填充实体 tbOrderDetail orderDetailObj = new tbOrderDetail(); orderDetailObj.Enable = true; orderDetailObj.InputTime = nowTime; orderDetailObj.Num = 0; orderDetailObj.OrderID = orderSn; orderDetailObj.PriceSum = 0; orderDetailObj.ProductID = pid; orderDetailObj.ProductName = title; orderDetailObj.ProductPrice = price; orderDetailObj.ShortDesc = string.Empty; orderDetailObj.UserPrice = closingPrice; int rowsAf = dbTran.Save(orderDetailObj); if (rowsAf < 1) { throw new Exception("Failed to save details about ordered product. Please try again later."); } //提交事务 dbTran.Commit(); //bool rtnVal = ComUtls.SendMail(email, "Hi:" + contact + "," + OConfig.GlobalConfig.SiteName + "site under an intention to order.", OConfig.GlobalConfig.SiteName + " site orders you specific information as follows:

UserName:" + contact + "

Company name:" + compName + "

Telephone number:" + tel + "

Mobile phone number:" + mobile + "

Email:" + email + "

Country:" + country + "

Address:" + addr + "

nquire intention description:" + content + "

Product title:" + title + "

Product URL:" + OConfig.Common.SiteDomain + objProd.PageURL, true, 5); // rtnVal = ComUtls.SendMail(OConfig.GlobalConfig.ReceivingOrderBuiltMailAddress, "Hello: Dear administrator." + contact + "," + OConfig.GlobalConfig.SiteName + " site under an intention to order.", contact + "," + OConfig.GlobalConfig.SiteName + " site orders you specific information as follows:

UserName:" + contact + "

Company name:" + compName + "

Telephone number:" + tel + "

Mobile phone number:" + mobile + "

Email:" + email + "

Country:" + country + "

Address:" + addr + "

nquire intention description:" + content + "

Product title:" + title + "

Product URL:" + OConfig.Common.SiteDomain + objProd.PageURL, true, 5); node1 = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", "Your purchase intention is successfully submitted, our related staff will contact you as soon as possible."); } catch (Exception ex) { dbTran.Rollback(); node1 = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", ex.Message); } finally { dbTran.Close(); } WriteXml(node1, node2); } ///

/// 产品详细页面套餐中的产品价格 /// private static void GetTaoCanPrice() { string IDList = GF("IDList"); string[] arr = IDList.Split(','); decimal OldPrice = 0; decimal NowPrice = 0; for (int i = 0; i < arr.Length;i++ ) { VW_Product Product = DbSession.Default.Get(VW_Product._.ID == int.Parse(arr[i])); //不存在冗于字段则返回 if (Product.CustomerFields == "") { if (BLL.Mem.CheckPassport()) { OldPrice += Product.UserPrice; NowPrice += Product.UserPrice; } else { OldPrice += Product.Price; NowPrice += Product.Price; } } else { BLL.KV kvv = new NSW.BLL.KV("$$", "||", Product.CustomerFields); //10、套装销售产品 //1>设置好是否显示套装勾选框 Boolean EnableCombos = ComUtls.ParseBool(kvv.GetValue("EnablePackage"), false); if (EnableCombos == true) { OldPrice += Product.Price; NowPrice += ComUtls.ParseDecimal(kvv.GetValue("PackagePrice"), 0); } else { if (BLL.Mem.CheckPassport()) { OldPrice += Product.UserPrice; NowPrice += Product.UserPrice; } else { OldPrice += Product.Price; NowPrice += Product.Price; } } } } KeyValuePair node1 = new KeyValuePair("OldPrice", OldPrice.ToString()); KeyValuePair node2 = new KeyValuePair("NowPrice", NowPrice.ToString()); WriteXml(node1, node2); } /// /// 产品愿望夹(产品列表页面的预览功能) /// private static void PostProductWishs() { string attr = GF("attr"); int num = ComUtls.ParseInt(GF("num"), 1); int oid = int.Parse(GF("oid")); if(!BLL.Mem.CheckPassport()) { WriteState(0, "Failed to add. You are not currently Sign in. Please log in and try again."); } VW_Product Product = DbSession.Default.Get(VW_Product._.ID == oid); if (Product==null) { WriteState(0, "Invalid request, the data does not exist."); } tbMyWish Obj = new tbMyWish(); Obj.Attr = attr; Obj.Num = num; Obj.PhotoPath = Product.PhotoPath; Obj.ProductID = oid; Obj.Title = Product.Title; Obj.Url = Product.PageURL; Obj.UserID = OSession.Mem.ID; Obj.Enable = false; Obj.InputTime = DateTime.Now; int row = DbSession.Default.Save(Obj); if (row > 0) { WriteState(1, "Successfully added to wishlist, please check"); } else { WriteState(0, "Failed to add to wishlist. Please try again later"); } } /// /// 产品愿望夹(产品列表页面的预览功能) /// private static void ShowMyWish() { StringBuilder sbRtnVal = new StringBuilder(); int ID = int.Parse(GF("oid")); VW_Product Obj = DbSession.Default.Get(VW_Product._.ID == ID); if(Obj==null) { WriteState(0, "The product does not exist!"); } sbRtnVal.Append("

My wishlist

"); sbRtnVal.Append("

Add to your wishlist

"); sbRtnVal.Append("
" + Obj.Title+ "
"); sbRtnVal.Append("
" + Obj.Title + "
"); sbRtnVal.Append(Obj.ShortDesc); sbRtnVal.Append("
"); sbRtnVal.Append("
"); DataTable dt = DbSession.Default.From().Select(tbProductAttribute._.KeyNameID).Where(tbProductAttribute._.ProductID == ID).ToDataTable(); if (dt.Rows.Count > 0) { //获得所有的置顶属性 foreach (DataRow ObjRow in dt.Rows) { //获得单独的一个属性对象 int KeyNameID = int.Parse(ObjRow["KeyNameID"].ToString()); tbProductAttributeColumn AttrCln = DbSession.Default.Get(tbProductAttributeColumn._.ID == KeyNameID); //是否存在这个属性对象 if (AttrCln == null) { continue; } //是否是置顶属性 if (!Obj.isTop) { continue; } //是否存在属性值 if (AttrCln.ValueList.Trim() == "") { continue; } //如果存在,开始追加属性输出(属性名) sbRtnVal.Append("
" + AttrCln.Title + ":
"); if (AttrCln.ValueList.IndexOf(",") != -1) { //不止一个置顶属性 string[] str = AttrCln.ValueList.Split(','); if (str.Length > 0) { foreach (string s in str) { int AttValID = int.Parse(s); //获得这个置顶属性的对象,得到对应的图片 tbProductAttributeValue tbAttValues = DbSession.Default.Get(tbProductAttributeValue._.ID == AttValID); if (tbAttValues.SmallPhotoPath != "") { //如果是图片的形式存在,则输出图片 sbRtnVal.Append(""); } else { //如果是文字的显示存在,则输出文字 sbRtnVal.Append("" + tbAttValues.Title + ""); } } } } else { //只有一个置顶属性 int AttValID = int.Parse(AttrCln.ValueList); //获得这个置顶属性的对象,得到对应的图片 tbProductAttributeValue tbAttValues = DbSession.Default.Get(tbProductAttributeValue._.ID == AttValID); if (tbAttValues.SmallPhotoPath != "") { //如果是图片的形式存在,则输出图片 sbRtnVal.Append(""); } else { //如果是文字的显示存在,则输出文字 sbRtnVal.Append("" + tbAttValues.Title + ""); } } sbRtnVal.Append("
"); } } sbRtnVal.Append("
Expected quantity:
"); sbRtnVal.Append("
Selected:
"); sbRtnVal.Append("
"); sbRtnVal.Append("
"); WriteString(sbRtnVal.ToString()); } /// /// 产品预定(产品列表页面的预览功能) /// private static void PostProductTips() { string email = GF("email"); string content = GF("content"); int state = int.Parse(GF("state")); int oid = int.Parse(GF("oid")); tbProductBooking Obj = new tbProductBooking(); Obj.ProductID = oid; Obj.ShortDesc = content; Obj.State = state; Obj.UserEmail = email; Obj.OrderID = 50; Obj.InputTime = DateTime.Now; int row = DbSession.Default.Save(Obj); if (row > 0) { WriteState(1, "The product is successfully reserved, and we will send you latest information about the product in time."); } else { WriteState(0, "Failed to reserve the product. Please try again later."); } } /// /// 获得产品的简单介绍(产品列表页面的预览功能) /// private static void ShowProductInfo() { StringBuilder sbRtnVal = new StringBuilder(); int ID = int.Parse(GF("oid")); int Index = int.Parse(GF("index")); VW_Product Obj = DbSession.Default.Get(VW_Product._.ID == ID); if (Obj == null) { return; } int n=0; n = Index % 4; if(n==0) { n = 4; } if (n > 2) { sbRtnVal.Append("
"); } else { sbRtnVal.Append("
"); } sbRtnVal.Append("

" + Obj.Title+ "

"); sbRtnVal.Append("
"+Obj.ShortDesc+"
"); // sbRtnVal.Append("
产品库存、发货状况信息xxxxxxxxxxxxxxxxxxxxxxxxxxxx
"); DataTable dt = DbSession.Default.From().Select(tbProductAttribute._.KeyNameID).Where(tbProductAttribute._.ProductID == ID).ToDataTable(); if(dt.Rows.Count>0) { foreach (DataRow ObjRow in dt.Rows) { //获得单独的一个属性对象 int KeyNameID = int.Parse(ObjRow["KeyNameID"].ToString()); tbProductAttributeColumn AttrCln = DbSession.Default.Get(tbProductAttributeColumn._.ID == KeyNameID); //是否存在这个属性对象 if (AttrCln == null) { continue; } //是否是置顶属性 if (!Obj.isTop) { continue; } //是否存在属性值 if (AttrCln.ValueList.Trim() == "") { continue; } //如果存在,开始追加属性输出(属性名) sbRtnVal.Append("
" + AttrCln.Title+ ":
"); if (AttrCln.ValueList.IndexOf(",") != -1) { //不止一个置顶属性 string[] str = AttrCln.ValueList.Split(','); if (str.Length > 0) { foreach (string s in str) { int AttValID = int.Parse(s); //获得这个置顶属性的对象,得到对应的图片 tbProductAttributeValue tbAttValues = DbSession.Default.Get(tbProductAttributeValue._.ID == AttValID); if (tbAttValues == null) { continue; } if (tbAttValues.SmallPhotoPath != "") { //如果是图片的形式存在,则输出图片 sbRtnVal.Append("" + tbAttValues.Title + ""); } else { //如果是文字的显示存在,则输出文字 sbRtnVal.Append("" + tbAttValues.Title + ""); } } } } else { //只有一个置顶属性 int AttValID = int.Parse(AttrCln.ValueList); //获得这个置顶属性的对象,得到对应的图片 tbProductAttributeValue tbAttValues = DbSession.Default.Get(tbProductAttributeValue._.ID == AttValID); if (tbAttValues==null) { continue; } if (tbAttValues.SmallPhotoPath != "") { //如果是图片的形式存在,则输出图片 sbRtnVal.Append("" + tbAttValues.Title + ""); } else { //如果是文字的显示存在,则输出文字 sbRtnVal.Append("" + tbAttValues.Title + ""); } } sbRtnVal.Append("
"); } } sbRtnVal.Append("
"); sbRtnVal.Append("
"); sbRtnVal.Append("
"); sbRtnVal.Append("
"); WriteString(sbRtnVal.ToString()); } /// /// 获得产品的简单介绍(产品列表页面的预览功能) /// private static void ShowProductInfos() { StringBuilder sbRtnVal = new StringBuilder(); int ID = int.Parse(GF("oid")); VW_Product Obj = DbSession.Default.Get(VW_Product._.ID == ID); if (Obj == null) { return; } sbRtnVal.Append("
"); sbRtnVal.Append("

" + Obj.Title + "

"); sbRtnVal.Append("
" + Obj.ShortDesc + "
"); // sbRtnVal.Append("
产品库存、发货状况信息xxxxxxxxxxxxxxxxxxxxxxxxxxxx
"); DataTable dt = DbSession.Default.From().Select(tbProductAttribute._.KeyNameID).Where(tbProductAttribute._.ProductID == ID).ToDataTable(); if (dt.Rows.Count > 0) { foreach (DataRow ObjRow in dt.Rows) { //获得单独的一个属性对象 int KeyNameID = int.Parse(ObjRow["KeyNameID"].ToString()); tbProductAttributeColumn AttrCln = DbSession.Default.Get(tbProductAttributeColumn._.ID == KeyNameID); //是否存在这个属性对象 if (AttrCln == null) { continue; } //是否是置顶属性 if (!Obj.isTop) { continue; } //是否存在属性值 if (AttrCln.ValueList.Trim() == "") { continue; } //如果存在,开始追加属性输出(属性名) sbRtnVal.Append("
" + AttrCln.Title + ":
"); if (AttrCln.ValueList.IndexOf(",") != -1) { //不止一个置顶属性 string[] str = AttrCln.ValueList.Split(','); if (str.Length > 0) { foreach (string s in str) { int AttValID = int.Parse(s); //获得这个置顶属性的对象,得到对应的图片 tbProductAttributeValue tbAttValues = DbSession.Default.Get(tbProductAttributeValue._.ID == AttValID); if (tbAttValues == null) { continue; } if (tbAttValues.SmallPhotoPath != "") { //如果是图片的形式存在,则输出图片 sbRtnVal.Append("" + tbAttValues.Title + ""); } else { //如果是文字的显示存在,则输出文字 sbRtnVal.Append("" + tbAttValues.Title + ""); } } } } else { //只有一个置顶属性 int AttValID = int.Parse(AttrCln.ValueList); //获得这个置顶属性的对象,得到对应的图片 tbProductAttributeValue tbAttValues = DbSession.Default.Get(tbProductAttributeValue._.ID == AttValID); if (tbAttValues == null) { continue; } if (tbAttValues.SmallPhotoPath != "") { //如果是图片的形式存在,则输出图片 sbRtnVal.Append("" + tbAttValues.Title + ""); } else { //如果是文字的显示存在,则输出文字 sbRtnVal.Append("" + tbAttValues.Title + ""); } } sbRtnVal.Append("
"); } } sbRtnVal.Append("
"); sbRtnVal.Append("
"); sbRtnVal.Append("
"); sbRtnVal.Append("
"); WriteString(sbRtnVal.ToString()); } /// /// 获得置顶属性值的图片 /// private static void GetAttrValuesPhotos() { StringBuilder sbRtnVal = new StringBuilder(); int ID =int.Parse(GF("oid")); tbProductExtendAttribute Obj = DbSession.Default.Get(tbProductExtendAttribute._.AttributeValueID == ID); if (Obj == null) { return; } if (Obj.PhotoPath != "") { string[] str = ComUtls.SplitByEnter(Obj.PhotoPath); for (int i = 0; i < str.Length; i++) { sbRtnVal.Append(""); } } WriteString(sbRtnVal.ToString()); //WriteState(1,sbRtnVal.ToString()); } /// /// 直接付款 /// private static void DirectPay() { //获取参数 string payer = ClearGF("payer"); string email = ClearGF("email"); string tel = ClearGF("tel"); string mobile = ClearGF("mobile"); string salesMan = ClearGF("salesMan"); decimal dMoney = ComUtls.ParseDecimal(GF("_money"), -1); string sUse = ClearGF("_use"); string payment = ClearGF("payment"); //判断参数 List lstErr = new List(); if (payer.Length == 0) { lstErr.Add("Payer cannot be blank"); } if (email.Length == 0) { lstErr.Add("E-mail address cannot be blank"); } else if (!ComUtls.CheckEmail(email)) { lstErr.Add("E-mail address format error"); } if (dMoney <= 0) { lstErr.Add("Payment amount must be a number greater than zero"); } if (sUse.Length == 0) { lstErr.Add("Use of proceeds cannot be blank"); } if (payment.Length == 0) { lstErr.Add("Please select the payment method"); } //如果有错误,则返回错误,中止操作 if (lstErr.Count > 0) { WriteState(0, GetError(lstErr)); return; } //写入cookie OCookie.Cart.DirectPayInfo.DMoney = dMoney; OCookie.Cart.DirectPayInfo.Mobile = mobile; OCookie.Cart.DirectPayInfo.Payee = (salesMan.Length > 0 ? salesMan : OConfig.GlobalConfig.SiteName); OCookie.Cart.DirectPayInfo.Payer = payer; OCookie.Cart.DirectPayInfo.SUse = sUse; OCookie.Cart.DirectPayInfo.Tel = tel; OCookie.Cart.DirectPayInfo.Email = email; //填充已选择的支付方式信息 tbPayMethod nobjPaymentMethod; if (payer == "alipay") { nobjPaymentMethod = BLL.Order.GetAlipayPaymentMethod(); } else { nobjPaymentMethod = BLL.Order.Get99BillPaymentMethod(); } OCookie.Cart.DirectPayInfo.PaymentMethodIcon = nobjPaymentMethod.PhotoPath; OCookie.Cart.DirectPayInfo.PaymentMethodID = nobjPaymentMethod.ID; OCookie.Cart.DirectPayInfo.PaymentMethodTitle = nobjPaymentMethod.Title; //回应 WriteState(1, "Direct payment is successfully submitted, now go to payment operation."); } /// /// 发送留言 /// private static void SendLeaveword01() { // 获取参数 string title = ClearGF("title"); // string compName = ClearGF("compName"); string cat = ClearGF("cat"); string contact = ClearGF("name"); string email = ClearGF("email"); string shortDesc = ClearGF("shortDesc"); string tel = ClearGF("tel"); string mobile = ClearGF("mobile"); string verCode = ClearGF("verCode"); //安全检查 SecurityCheck(verCode, CheckingType.BlockToSubmitIPs, CheckingType.ForbiddenIP, CheckingType.GlobalSubmittingFrequency, CheckingType.VerifyCode); //SecurityCheck(null, CheckingType.BlockToSubmitIPs, CheckingType.ForbiddenIP, CheckingType.GlobalSubmittingFrequency); //保存记录 tbLeaveword nobj = new tbLeaveword(); nobj.Category = cat; nobj.Contact = contact; nobj.Country = ""; nobj.Content = shortDesc; nobj.Email = email; nobj.Enable = false; nobj.InputTime = DateTime.Now; nobj.IP = IP; nobj.MobileNo = mobile; nobj.OrderID = 50; nobj.TelNo = tel; nobj.Title = title; int rowsAffected = DbSession.Default.Save(nobj); //回应 if (rowsAffected > 0) { //更新最后提交时间 OSession.Common.LastPost = DateTime.Now; //发送邮件通知致管理员 if (OConfig.GlobalConfig.SendingReportsMailNotifyToAdmin) { BLL.Help.SendLeavewordMailNotify(nobj); } WriteState(1, "Thank you for your comments, we will do better with your support."); } else { WriteState(0, "Sorry, failed to submit. Please try again later."); } } /// /// 发送留言 /// private static void SendLeaveword() { // 获取参数 string title = ClearGF("title"); // string compName = ClearGF("compName"); string cat = ClearGF("cat"); string contact = ClearGF("contact"); string email = ClearGF("email"); string shortDesc = ClearGF("shortDesc"); string tel = ClearGF("tel"); string mobile = ClearGF("mobile"); //安全检查 SecurityCheck(null, CheckingType.BlockToSubmitIPs, CheckingType.ForbiddenIP, CheckingType.GlobalSubmittingFrequency); //保存记录 tbLeaveword nobj = new tbLeaveword(); nobj.Category = cat; nobj.Contact = contact; nobj.Content = shortDesc; nobj.Email = email; nobj.Enable = false; nobj.InputTime = DateTime.Now; nobj.IP = IP; nobj.MobileNo = mobile; nobj.OrderID = 50; nobj.TelNo = tel; nobj.Title = title; int rowsAffected = DbSession.Default.Save(nobj); //回应 if (rowsAffected > 0) { //更新最后提交时间 OSession.Common.LastPost = DateTime.Now; //发送邮件通知致管理员 if (OConfig.GlobalConfig.SendingReportsMailNotifyToAdmin) { BLL.Help.SendLeavewordMailNotify(nobj); } WriteState(1, "Thank you for your comments, we will do better with your support."); } else { WriteState(0, "Sorry, failed to submit. Please try again later."); } } /// /// 发送错误报告 /// private static void SendReports() { // 获取参数 string title = ClearGF("title"); string url = ClearGF("url"); string cat = ClearGF("cat"); string contact = ClearGF("contact"); string email = ClearGF("email"); string shortDesc = ClearGF("shortDesc"); //安全检查 SecurityCheck(null, CheckingType.BlockToSubmitIPs, CheckingType.ForbiddenIP, CheckingType.GlobalSubmittingFrequency); //保存记录 tbBugReport nobj = new tbBugReport(); nobj.BugReportColumnName = cat; nobj.BugReportContact = contact; nobj.BugReportDill = false; nobj.BugReportDillName = string.Empty; nobj.BugReportDillRemark = string.Empty; nobj.BugReportShortDesc = shortDesc; nobj.BugReportURL = url; nobj.BugReportUserEmail = email; nobj.BugReportWebsiteURL = url; nobj.InputTime = DateTime.Now; nobj.IP = IP; nobj.Title = title; //冗余字段 nobj.BugReportCompName = string.Empty; nobj.BugReportMphone = string.Empty; nobj.BugReportMSN = string.Empty; nobj.BugReportPhone = string.Empty; nobj.BugReportQQ = string.Empty; nobj.Enable = true; int rowsAffected = DbSession.Default.Save(nobj); //回应 if (rowsAffected > 0) { //更新最后提交时间 OSession.Common.LastPost = DateTime.Now; //发送邮件通知致管理员 if (OConfig.GlobalConfig.SendingReportsMailNotifyToAdmin) { BLL.Site.SendReportsToAdmin(nobj); } WriteState(1, "Thank you for your report, we will do better with your support."); } else { WriteState(0, "Sorry, failed to submit. Please try again later."); } } /// /// 获取留言分类 /// private static void GetLeavewordCategories() { WriteString(OConfig.GlobalConfig.LeavewordCategories); } /// /// 获取报告分类 /// private static void GetReportCategories() { WriteString(OConfig.GlobalConfig.ReportCategories); } /// /// 投票 /// private static void Survey() { //获取参数 int subjectID = ComUtls.ParseInt(GF("_SUR_SubjectID"), -1); string checkedItems = GF("_CheckedItems"); HttpCookie cookie = OCookie.UserCookie.SurveySubject; string[] arrCheckedItm = StringUtls.Split(checkedItems, ","); //检查参数 if (subjectID < 1 || !ComUtls.CheckIDsFormat(checkedItems)) { WriteState(0, "Illegal parameter"); return; } //检查该浏览器是参与同主题投票(COOKIE保存主题ID) if (BLL.Survey.HasHistoryInCookie(subjectID)) { WriteState(0, "Thank you for your participation and attention."); return; } //从DB读取主题 WhereClip nwhere = (tbSurvey._.ID == subjectID && OConst.Survey.WhereEnabled); tbSurvey surveyObj = DbSession.Default.Get(nwhere); //如果主题不存在、或禁用,回应消息 if (surveyObj == null) { WriteState(0, "Invalid vote subject"); return; } //检查已选择项与主题投票模式是否相符(单选/复选) if (surveyObj.SelectionMode == 1 && arrCheckedItm.Length > 1) { WriteState(0, "Invalid vote pattern."); return; } //检查已选择的投票项是否合法 if (!BLL.Survey.IsLegalSurvey(arrCheckedItm, subjectID)) { WriteState(0, "Invalid vote item."); return; } string s = ""; //提交投票 bool tmpB = BLL.Survey.SubmitSurvey(arrCheckedItm, subjectID, ref s); //回应消息 if (tmpB) { WriteState(1, "The vote is successfully submitted, thank you for your participation."); } else { WriteState(0, "Sorry, failed to submit the vote. Please try again later or contact the website administrator"); } } /// /// 收集用户信息 /// private static void CollectionUserInfo() { //获取参数 string fromUsername = ClearGF("FromUsername"); string fromSiteName = ClearGF("FromSiteName"); string fromUrl = ClearGF("FromUrl"); string fromTitle = ClearGF("FromTitle"); string fromKeyName = ClearGF("FromKeyName"); // string compName = ClearGF("CompName"); string contact = ClearGF("Contact"); string email = ClearGF("Email"); string phone = ClearGF("Phone"); string mPhone = ClearGF("MPhone"); string QQ = ClearGF("QQ"); string MSN = ClearGF("MSN"); //安全检查 SecurityCheck(null, CheckingType.BlockToSubmitIPs, CheckingType.ForbiddenIP, CheckingType.GlobalSubmittingFrequency); //保存记录到DB tbSiteAnalysize nobj = new tbSiteAnalysize(); nobj.CompName = compName; nobj.Contact = contact; nobj.Email = email; nobj.FromKeyName = fromKeyName; nobj.FromSiteName = fromSiteName; nobj.FromUrl = fromUrl; nobj.FromTitle = fromTitle; nobj.FromUsername = fromUsername; nobj.InputTime = DateTime.Now; nobj.IP = IP; nobj.MPhone = mPhone; nobj.MSN = MSN; nobj.Phone = phone; nobj.QQ = QQ; nobj.ShortDesc = string.Empty; int rowsAffected = DbSession.Default.Save(nobj); //保存成功后更新最后提交时间 if (rowsAffected > 0) { OSession.Common.LastPost = DateTime.Now; WriteString("1"); } else { WriteString("0"); } } #region ********************* 代理加盟 ************************** /// /// 招商加盟满意度(帮助作用)反馈 /// private static void AgentHelpUseful() { KeyValuePair key1 = new KeyValuePair(); KeyValuePair key2 = new KeyValuePair(); //1> 获取参数 string notion = GF("notion").ToLower(); int oid = ComUtls.ParseInt(GF("oid"), -1); //2> 判断参数 if (oid < 1) { return; } if (notion != "1" && notion != "2" && notion != "3") { return; } //3> 检查提交频率是否可疑 if (!BLL.OSecurity.CheckInterval(OSession.Common.LastPost, 15)) { key1 = new KeyValuePair("state", "0"); key2 = new KeyValuePair("msg", "Your opinion on satisfaction degree is submitted too frequently. Invalid submission, thank you for your participation."); WriteXml(key1, key2); return; } //4> 增加满意度 string fieldName; switch (notion) { case "1": fieldName = "AgentComplete"; break; case "2": fieldName = "AgentSome"; break; default: fieldName = "AgentLess"; break; } //事务处理 DbTran tran = DbSession.Default.BeginTran(); int rowsAffected = -1; int logRowsAffected = -1; try { string cmdText = string.Format("UPDATE {0} SET {1}={1}+1 WHERE [ID]={2}", ORes.OTableName.tbAgent, fieldName, oid); rowsAffected = tran.Excute(cmdText); tbAgentSurvery objAgentSurvery = new tbAgentSurvery(); objAgentSurvery.AgentComplete = (notion == "1"); objAgentSurvery.AgentID = oid; objAgentSurvery.AgentLess = (notion == "3"); objAgentSurvery.AgentSome = (notion == "2"); objAgentSurvery.InputTime = DateTime.Now; objAgentSurvery.UserIP = IP; objAgentSurvery.UserName = OSession.Mem.Username; logRowsAffected = tran.Save(objAgentSurvery); tran.Commit(); } catch { tran.Rollback(); } finally { tran.Close(); } //5> 回应消息 if (rowsAffected > 0) { OSession.Common.LastPost = DateTime.Now; key1 = new KeyValuePair("state", "1"); key2 = new KeyValuePair("msg", "Successfully submitted, thank you for your participation."); WriteXml(key1, key2); } else { OSession.Common.LastPost = DateTime.Now; key1 = new KeyValuePair("state", "0"); key2 = new KeyValuePair("msg", "Failed to submit. Please try again later."); WriteXml(key1, key2); } } /// /// 招商加盟满意度 /// private static void AgentHelpSatisfaction() { //1> 获取参数 int oid = ComUtls.ParseInt(GF("oid"), -1); //2> 检查参数 if (oid < 1) { WriteString(ORes.Error.ObjectIDDoesNotExistOrIncorrect); return; } //3> 查询数据 WhereClip nwhere = (tbAgent._.Enable == true && tbAgent._.ID == oid); Field[] nfields = new Field[] { tbAgent._.AgentComplete, tbAgent._.AgentLess, tbAgent._.AgentSome }; DataTable dt = DbSession.Default .From() .Select(nfields) .Where(nwhere) .ToDataTable(1); if (dt.Rows.Count == 0) { WriteString(ORes.Error.ObjectDoesNotExist); return; } //4> 输出XML KeyValuePair key1 = new KeyValuePair("1", dt.Rows[0][tbAgent._.AgentComplete.Name].ToString()); KeyValuePair key2 = new KeyValuePair("2", dt.Rows[0][tbAgent._.AgentSome.Name].ToString()); KeyValuePair key3 = new KeyValuePair("3", dt.Rows[0][tbAgent._.AgentLess.Name].ToString()); WriteXml(key1, key2, key3); } #endregion /// /// 发送邀请注册函(只接受单个电子邮箱地址) /// private static void SendInvitation() { //获取参数 string email = GF("_email"); //参数检查 if (!ComUtls.CheckEmail(email)) { return; } //安全检查 SecurityCheck(null, CheckingType.BlockToSubmitIPs, CheckingType.ForbiddenIP, CheckingType.GlobalSubmittingFrequency); //发送邀请函 string rename = (OSession.Mem.User.ChnName.Length > 0 ? OSession.Mem.User.ChnName : OSession.Mem.Username); string body = string.Format("I am {0},I think that the services provided by {1} website are good after becoming a member. It is worthy to have a try.", rename, OConfig.GlobalConfig.SiteName); int successfullySendTimes = BLL.Mem.SendInitationRegisterMail(email, body); //回应 if (successfullySendTimes > 0) { //更新最后提交的时间 OSession.Common.LastPost = DateTime.Now; string msg = string.Format("Congratulations, {0} invitation letters have been sent. Please notify recipients to receive the E-mail by telephone, or notify recipients to receive the E-mail and register by SMS. Thank you for supporting {1} website!" + "$$Continue to send the invitation" + "||My list of invitation letters", successfullySendTimes, OConfig.GlobalConfig.SiteName); KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("msg", msg); WriteXml(node, node2); } else { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "No invitation letter is sent"); WriteXml(node, node2); } } /// /// 删除邀请函日志 /// private static void DelInitationlog() { if (!BLL.Mem.CheckPassport()) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "You are not currently a member, thus favorite function is not available.
Please log in or register."); WriteXml(node, node2); return; } //1 获取参数 string ids = GF("ids"); string[] s_id = ids.Split(','); //3 查询数据库 int rowsAffected = 0; for (int i = 1; i < s_id.Length; i++) { WhereClip nwhere = (tbMyfavorite._.ID == s_id[i] && tbMyfavorite._.UserID == OSession.Mem.ID); rowsAffected = DbSession.Default.Delete(nwhere); } //4 回应 if (rowsAffected > 0) { KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("The invitation letter is successfully deleted, and {0} records are deleted in total.", rowsAffected)); WriteXml(node, node2); return; } else { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Failed to delete the invitation letter. Please try again later."); WriteXml(node, node2); return; } } /// /// 浏览过此产品的人还浏览过 /// public static void GetRelevantViewed() { if (!OSwitch.RelevantProduct || !OConfig.GlobalConfig.Product.EnableRelevantProduct) { WriteString(string.Empty); return; } //1 获取参数 int srcProdId = ComUtls.ParseInt(GF("oid"), -1); //2 从DB获取数据 Field[] nfields = new Field[]{ VW_Product._.Title, VW_Product._.ShortDesc, VW_Product._.PhotoPath, VW_Product._.PageURL, VW_Product._.ID }; DataTable dt = BLL.Product.GetRelevantViewed(srcProdId, nfields, 4); if (dt.Rows.Count == 0) { return; } //3 根据模板生成HTML代码 string template = "<$Foreach$>
" + "
\"{$Title$}\"
" + "
{$Title$}
" + "
{$ShortDesc$}
" + "
<$EndForeach$>"; //4 回应 WriteString(BLL.Template.ProcessTemplate(template, dt)); } /// /// 浏览过此下载信息的人还浏览过 /// public static void GetRelevantViewedDownload() { //1 获取参数 int srcProdId = ComUtls.ParseInt(GF("oid"), -1); //2 从DB获取数据 Field[] nfields = new Field[]{ VW_Download._.Title, VW_Download._.ShortDesc, VW_Download._.PhotoPath, VW_Download._.PageURL, VW_Download._.ID }; DataTable dt = BLL.Download.GetRelevantViewed(srcProdId, nfields, 3); if (dt.Rows.Count == 0) { return; } //3 根据模板生成HTML代码 string template = "<$Foreach$>
" + "
\"{$Title$}\"
" + "
{$Title$} {$ShortDesc$}
" + "
<$EndForeach$>"; //4 回应 WriteString(BLL.Template.ProcessTemplate(template, dt)); } /// /// 购买过某样产品的人还购物过的产品 /// public static void GetRelevantSales() { if (!OSwitch.RelevantProduct || !OConfig.GlobalConfig.Product.EnableRelevantProduct) { WriteString(string.Empty); return; } //1 获取参数 int srcProdId = ComUtls.ParseInt(GF("oid"), -1); //2 从DB获取数据 Field[] nfields = new Field[]{ VW_Product._.Title, VW_Product._.ShortDesc, VW_Product._.PhotoPath, VW_Product._.PageURL, VW_Product._.ID }; DataTable dt = BLL.Product.GetRelevantSales(srcProdId, nfields, 3); if (dt.Rows.Count == 0) { return; } //3 根据模板生成HTML代码 string template = "<$Foreach$>
" + "
\"{$Title$}\"
" + "
{$Title$}
" + "
{$ShortDesc$}
" + "
<$EndForeach$>"; //4 回应 WriteString(BLL.Template.ProcessTemplate(template, dt)); } /// /// 根据浏览历史推荐产品 /// public static void GetRecommentProductByHistory() { if (!OSwitch.RelevantProduct || !OConfig.GlobalConfig.Product.EnableRelevantProduct) { WriteString(string.Empty); return; } //1 获取参数 int srcProdId = ComUtls.ParseInt(GF("oid"), -1); //2 从DB获取数据 Field[] nfields = new Field[]{ VW_Product._.Title, VW_Product._.Price, VW_Product._.UserPrice, VW_Product._.PhotoPath, VW_Product._.PageURL, VW_Product._.ID }; DataTable dt = NSW.CommonMethod.GetRecommendRandomProduct(12, srcProdId);//CommonMethod.GetRecommendRandomProduct(10,0;;//BLL.Product.GetRecommendProductByHistory(nfields, srcProdId, 6); if (dt.Rows.Count == 0) { return; } //3 根据模板生成HTML代码 string template = "

Recommended Products

" + "
" + "<$Foreach$>
" + "
\"{$Title$}\"
" + "
{$Title$}
" + "
<$EndForeach$>" + "
" + "
"; //4 回应 WriteString(BLL.Template.ProcessTemplate(template, dt)); } /// /// 更新收藏夹分类 /// private static void ChangeFavColumn() { //1 获取参数 string ids = GF("ids"); int targetId = ComUtls.ParseInt(GF("targetId"), 1); //2 检查参数 if (!ComUtls.CheckIDsFormat(ids)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Parameter error:ids"); WriteXml(node, node2); return; } //3 更新数据库 WhereClip nwhere = (tbMyfavorite._.ID.In(ids.Split(',')) && tbMyfavorite._.UserID == OSession.Mem.ID); Field[] nfields = { tbMyfavorite._.ColumnID }; object[] nvals = { targetId }; int rowsAffected = DbSession.Default.Update(nfields, nvals, nwhere); //4 回应 if (rowsAffected > 0) { KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("msg", "Updated successfully。"); WriteXml(node, node2); return; } } /// /// 检查权限 /// private static void CheckAuthority() { //1 获取参数 string authorityIds = GF("authIDs"); //2 检查会员是否具体所需权限 bool authorized = BLL.Mem.CheckAuthority(authorityIds); //3 回应 WriteString(authorized ? "1" : "0"); } /// /// 会员反馈/意见 /// private static void UserFeedback() { KeyValuePair node1; KeyValuePair node2; bool isLogin = BLL.Mem.CheckPassport(); tbUser objUser = OSession.Mem.User; //1 获取参数 string title = HttpUtility.HtmlEncode(GF("title").Trim()); string shortDesc = HttpUtility.HtmlEncode(GF("shortDesc").Trim()); //2 检查参数 if (title.Length == 0 || shortDesc.Length == 0) { node1 = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "Content or title cannot be blank."); WriteXml(node1, node2); return; } //3 安全检查 SecurityCheck(null, CheckingType.BlockToSubmitIPs, CheckingType.ForbiddenIP, CheckingType.GlobalSubmittingFrequency); //4 填充实体 DateTime nowTime = DateTime.Now; tbFeedback nobj = new tbFeedback(); nobj.Answer = string.Empty; nobj.AnswerTime = nowTime; nobj.ChnName = objUser.ChnName; nobj.Email = objUser.UserEmail; nobj.Enable = true; nobj.InputTime = nowTime; nobj.IP = IP; nobj.MPhone = objUser.MPhone; nobj.OrderID = 50; nobj.Phone = objUser.Phone; nobj.ShortDesc = shortDesc; //预留字段 nobj.SubSite = string.Empty; nobj.Title = title; nobj.UserID = objUser.ID; nobj.Username = objUser.UserName; //5 保存数据库 int rowsAffected = DbSession.Default.Save(nobj); //6 回应,设置最后提交时间 if (rowsAffected > 0) { OSession.Common.LastPost = nowTime; node1 = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", "Thank you for taking the time to give advice and suggestions. Your support drives us to grow. Thank you for supporting our website!"); WriteXml(node1, node2); } else { node1 = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "Sorry, failed to submit the vote. Please try again later."); WriteXml(node1, node2); } } /// /// 邮件订阅 /// private static void Subscription() { KeyValuePair node1; KeyValuePair node2; //1 获取参数 string email = GF("email"); //2 检查参数 if (!ComUtls.CheckEmail(email)) { node1 = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", "E-mail address format error."); WriteXml(node1, node2); return; } //3 订阅 OEnum.Common.MailSubscriptionResult result = BLL.Site.MailSubscription(email, OSession.Mem.Username, OSession.Mem.ID); switch (result) { case NSW.OEnum.Common.MailSubscriptionResult.Failed: node1 = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", string.Format("Failed to subscribe {0} by your E-mail due to the system reasons. Please contact our administrator immediately, thank you for your support!", email)); break; case NSW.OEnum.Common.MailSubscriptionResult.Inactive: node1 = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", string.Format("Congratulations! Your E-mail has been successfully delivered. To ensure that you can receive our E-magazine without error, a confirmation mail has been sent to your mailbox {0}, please check. Thank you for your support!", email)); break; case NSW.OEnum.Common.MailSubscriptionResult.MailExists: node1 = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", string.Format("Congratulations! Your E-mail has been successfully delivered. To ensure that you can receive our E-magazine without error, a confirmation mail has been sent to your mailbox {0}, please check. Thank you for your support!", email)); break; case NSW.OEnum.Common.MailSubscriptionResult.Subscripted: node1 = new KeyValuePair("state", "0"); node2 = new KeyValuePair("msg", string.Format("Your E-mail {0} has submitted subscription request before. Please do not submit repeatedly, thank you for your support!", email)); break; default: node1 = new KeyValuePair("state", "1"); node2 = new KeyValuePair("msg", string.Format("Congratulations! Your E-mail has been successfully delivered. To ensure that you can receive our E-magazine without error, a confirmation mail has been sent to your mailbox {0}, please check. Thank you for your support!", email)); break; } // end switch //4 回应 WriteXml(node1, node2); } /// /// 删除浏览历史 /// private static void CleanHistory() { string mark = GF("mark"); switch (mark) { case "news": ComUtls.RemoveCookie(OHistory.COOKIE_KEY_PRODUCT); break; case "project": OHistory.Project.Clear(); break; case "download": OHistory.Download.Clear(); break; default: OHistory.Product.Clear(); break; } } /// /// 获取最新发布的文章 /// private static void GetLastArticle() { string rsp; //1 获取参数 //2 从数据库读取数据 WhereClip nwhere = (VW_News._.Enable == true && VW_News._.ShowTime < DateTime.Now); OrderByClip norder = (VW_News._.ShowTime.Desc); Field[] nfield = new Field[] { VW_News._.ID, VW_News._.PageURL, VW_News._.Title, VW_News._.ShowTime }; DataTable dt = DbSession.Default.From().Where(nwhere).OrderBy(norder).Select(nfield).ToDataTable(10); //3 生成内容 string template = "<$Foreach$>
  • {$Title$}
  • <$EndForeach$>"; rsp = BLL.Template.ProcessTemplate(template, dt); //4 回应 WriteString(rsp); } /// /// 获取相关文章 /// private static void GetSimilarArticle() { string rsp; //1 获取参数 string sid = GF("sid"); //2 从数据库读取数据 WhereClip nwhere = (VW_News._.sid == sid && VW_News._.Enable == true && VW_News._.ShowTime < DateTime.Now); OrderByClip norder = (VW_News._.ShowTime.Desc); Field[] nfield = new Field[] { VW_News._.ID, VW_News._.PageURL, VW_News._.Title, VW_News._.ShowTime }; DataTable dt = DbSession.Default.From().Where(nwhere).OrderBy(norder).Select(nfield).ToDataTable(10); //3 生成内容 string template = "<$Foreach$>
  • {$Title$}
  • <$EndForeach$>"; rsp = BLL.Template.ProcessTemplate(template, dt); //4 回应 WriteString(rsp); } /// /// 获取对象点击率 /// private static void GetHits() { string tabName; int hits = -1; //1 获取参数 string mark = GF("mark"); int oid = ComUtls.ParseInt(GF("oid"), -1); //2 获取表名 switch (mark) { case "help": tabName = ORes.OTableName.tbHelp; break; case "news": tabName = ORes.OTableName.tbNews; break; case "project": tabName = ORes.OTableName.tbProject; break; case "download": tabName = ORes.OTableName.tbDownload; break; #region ********************* 代理加盟 ************************** case "agent": tabName = ORes.OTableName.tbAgent; break; #endregion default: tabName = ORes.OTableName.tbProduct; break; } // end switch //3 从数据库读取点击率 string cmdText = string.Format("SELECT [Hits] FROM {0} WHERE [ID]={1}", tabName, oid); object o = DbSession.Default.FromSql(cmdText).ToScalar(); if (o != null) { hits = (int)o; } //4 回应 WriteString(hits.ToString()); } /// /// 根据浏览历史推荐方案服务 /// public static void GetRecommentProjectByHistory() { //1 获取参数 int srcProdId = ComUtls.ParseInt(GF("oid"), -1); //2 从DB获取数据 Field[] nfields = new Field[]{ VW_Project._.Title, VW_Project._.PhotoPath, VW_Project._.PageURL, VW_Project._.ID }; DataTable dt = BLL.Project.GetRecommendProjectByHistory(nfields, srcProdId, 6); if (dt.Rows.Count == 0) { return; } //3 根据模板生成HTML代码 string template = "

    Recommended for you based on your browsing history

    " + "
    " + "<$Foreach$>
    " + "
    \"{$Title$}\"
    " + "
    {$Title$}
    " + "
    <$EndForeach$>" + "
    " + "
    "; //4 回应 WriteString(BLL.Template.ProcessTemplate(template, dt)); } /// /// 获取浏览历史 /// private static void GetHistory() { //1 获取参数 string mark = GF("mark"); WhereClip nwhere; // OrderByClip norder; Field[] nfields; string[] arrID; string template; string rsp; DataTable dt; //2 进行不同的对象处理 switch (mark) { case "news": //获取浏览历史ID arrID = OHistory.GetIDArray(mark); //从数据库读取 nwhere = (VW_News._.ID.In(OHistory.GetIDArray(mark))); nfields = new BlueCrystal.Data.Field[] { VW_News._.ID, VW_News._.PageURL, VW_News._.Title }; dt = DbSession.Default.From().Where(nwhere).Select(nfields).ToDataTable(10); template = "<$Foreach$>
  • {$Title$}
  • <$EndForeach$>"; rsp = BLL.Template.ProcessTemplate(template, dt); break; case "project": nfields = new BlueCrystal.Data.Field[] { VW_ProjectViewedHistory._.ID, VW_ProjectViewedHistory._.PageTitle, VW_ProjectViewedHistory._.PageURL, VW_ProjectViewedHistory._.PhotoPath, VW_ProjectViewedHistory._.Title }; dt = OHistory.Project.GetHistory(nfields); template = "

    ClearRecently viewed programs

    " + "
    " + "<$Foreach$>
    " + "
    {$Title$}
    " + "
    {$Title$}
    " + "
    <$EndForeach$>" + "
    " + "
    "; // 回应 rsp = BLL.Template.ProcessTemplate(template, dt); break; //下载中心 case "download": nfields = new BlueCrystal.Data.Field[] { VW_DownloadViewedHistory._.ID, VW_DownloadViewedHistory._.PageTitle, VW_DownloadViewedHistory._.PageURL, VW_DownloadViewedHistory._.PhotoPath, VW_DownloadViewedHistory._.Title }; dt = OHistory.Download.GetHistory(nfields); template = "<$Foreach$>
    " + "
    {$Title$}
    " + "
    {$Title$}
    " + "
    <$EndForeach$>"; // 回应 rsp = BLL.Template.ProcessTemplate(template, dt); break; // 产品 default: ////获取浏览历史ID //arrID = OHistory.GetIDArray("product"); ////从数据库读取 //nwhere = (VW_ProductViewedHistory._.ID.In(OHistory.GetIDArray("product"))); nfields = new BlueCrystal.Data.Field[] { VW_ProductViewedHistory._.ID, VW_ProductViewedHistory._.PageTitle, VW_ProductViewedHistory._.PageURL, VW_ProductViewedHistory._.UserPrice, VW_ProductViewedHistory._.PhotoPath, VW_ProductViewedHistory._.Title }; dt = OHistory.Product.GetHistory(nfields); template = "

    ClearRecently viewed products

    " + "
    " + "<$Foreach$>
    " + "
    {$Title$}
    " + "
    {$Title$}
    " + "
    <$EndForeach$>" + "
    " + "
    "; // 回应 rsp = BLL.Template.ProcessTemplate(template, dt); break; } WriteString(rsp); } /// /// 获取收货评语 /// private static void GetEndingRemark() { string rtnVal; string rename = "EndingRemark_2"; DataTable dt = BLL.Order.GetEndingRemark(10); dt.Columns.Add(new DataColumn(rename, typeof(string))); //订单状态 foreach (DataRow row in dt.Rows) { string remark = row[tbOrder._.EndingRemark.Name].ToString(); row[rename] = StringUtls.Ellipsis(remark, 23); } string template = "

    \"contract\"Customer’s feedback

    " + "
    " + "
      " + "<$Foreach$>
    • {$EndingRemark_2$}<$EndForeach$>" + "
    " + "
    " + ""; template = template.Replace("{$SkinPath$}", OConfig.Common.Skin); rtnVal = BLL.Template.ProcessTemplate(template, dt); WriteString(rtnVal); } /// /// 获取订单公告 /// private static void GetOrderAnnouncement() { string rtnVal; DataTable dt = BLL.Order.GetOrderAnnouncement(10); string template = "

    \"contract\"Order notice

    " + "
    " + "
      " + "<$Foreach$>
    • Order {$OrderNo$} {$OrderState_2$}
    • <$EndForeach$>" + "
    " + "
    " + ""; template = template.Replace("{$SkinPath$}", OConfig.Common.Skin); rtnVal = BLL.Template.ProcessTemplate(template, dt); WriteString(rtnVal); } /// /// 获取视频代码 /// private static void GetVideo() { //1 获取视频关键词 string videoKey = GF("videoKey"); //4 回应 WriteString(BLL.Site.GetVideoCodeByKeyName(videoKey)); } /// /// 获取广告代码 /// private static void GetAd() { StringBuilder rsp = new StringBuilder(); //1 获取参数 string keyName = GF("keyname"); //2 查询数据库 WhereClip nwhere = (VW_Ad._.KeyName == keyName && VW_Ad._.isShow == true); VW_Ad nobj = DbSession.Default.Get(nwhere); if (nobj == null) { WriteString(string.Empty); return; } //3 广告类型 switch (nobj.Photo) { //3.1 图片 case 1: if (nobj.URL.Length > 0) { rsp.AppendFormat("", nobj.URL); } rsp.AppendFormat(" 0 || nobj.Height > 0) { rsp.Append(" style='"); if (nobj.Height > 0) { rsp.AppendFormat("height:{0}px;", nobj.Height); } if (nobj.Width > 0) { rsp.AppendFormat("width:{0}px;", nobj.Width); } rsp.Append("'"); } rsp.Append(" />"); if (nobj.URL.Length > 0) { rsp.Append(""); } break; //3.2 FLASH case 2: if (nobj.URL.Length > 0) { rsp.AppendFormat("", nobj.URL); } rsp.Append(" 0 || nobj.Height > 0) { if (nobj.Height > 0) { rsp.AppendFormat(" height='{0}'", nobj.Height); } if (nobj.Width > 0) { rsp.AppendFormat(" width='{0}'", nobj.Width); } } rsp.AppendFormat(">" + "" + " 0 || nobj.Height > 0) { if (nobj.Height > 0) { rsp.AppendFormat(" height='{0}'", nobj.Height); } if (nobj.Width > 0) { rsp.AppendFormat(" width='{0}'", nobj.Width); } } rsp.Append(">"); if (nobj.URL.Length > 0) { rsp.Append(""); } break; //3.3 代码 default: rsp.Append(nobj.JS); break; } //4 回应 WriteString(rsp.ToString()); } /// /// 添加浏览历史 /// private static void AddHistory() { //1 获取参数 string mark = QS("mark"); int oid = ComUtls.ParseInt(QS("oid"), -1); string objType; //2 检查参数 if (oid < 1) { return; } switch (mark) { case "news": objType = "news"; break; case "project": objType = "project"; OHistory.Project.Add(oid); break; case "download": objType = "download"; OHistory.Download.Add(oid); break; //产品浏览历史 default: OHistory.Product.Add(oid); return; } //添加到历史对象 OHistory.Add(oid, objType); } /// /// 获取评论 /// private static void GetComment() { string mark = GF("mark"); string subjectId = GF("oid"); string columnId; StringBuilder sbRsp = new StringBuilder(); sbRsp.Append(""); switch (mark) { case "news": columnId = "2"; break; case "project": columnId = "3"; break; case "download": columnId = "4"; break; default: columnId = "1"; break; } string sqlWhere = string.Format("[ColumnID]={0} AND [SubjectID]={1} AND [Enable]=1", columnId, subjectId); string sqlOrder = "[InputTime] DESC, [OrderID] ASC"; string tabName = ORes.OTableName.tbComment; int pageSize = 5; int pageIndex = 1; int recordTotal = -1; string pk = "[ID]"; string fields = ComUtls.GetFields(false, tbComment._.ID, tbComment._.Content, tbComment._.InputTime, tbComment._.Integral, tbComment._.LastIP, tbComment._.UserName, tbComment._.FeedBack, tbComment._.Title); DataTable dt = MQuery.GetBatch(tabName, pk, fields, sqlOrder, sqlWhere, pageSize, pageIndex, ref recordTotal); sbRsp.Append(""); sbRsp.AppendFormat("{0}", recordTotal); foreach (DataRow row in dt.Rows) { string content = row[tbComment._.Content.Name].ToString(); string inputTime = ComUtls.FormatDateTime((DateTime)row[tbComment._.InputTime.Name]); string integral = row[tbComment._.Integral.Name].ToString(); string ip = ComUtls.CutIp(row[tbComment._.LastIP.Name].ToString(), 2); string username = row[tbComment._.UserName.Name].ToString(); string title = row[tbComment._.Title.Name].ToString(); string feedback = row[tbComment._.FeedBack.Name].ToString() == "" ? "No reply for now" : row[tbComment._.FeedBack.Name].ToString(); sbRsp.AppendFormat(""); sbRsp.AppendFormat("{0}", content); sbRsp.AppendFormat("{0}", inputTime); sbRsp.AppendFormat("{0}", integral); sbRsp.AppendFormat("{0}", ip); sbRsp.AppendFormat("{0}", username); sbRsp.AppendFormat("{0}", title); sbRsp.AppendFormat("{0}", feedback); sbRsp.AppendFormat(""); } sbRsp.Append(""); WriteXml(sbRsp.ToString()); } /// /// 删除收藏 /// private static void DelFav() { if (!BLL.Mem.CheckPassport()) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "You are not currently a member, thus favorite function is not available.
    Please log in or register."); WriteXml(node, node2); return; } //1 获取参数 string ids = GF("ids"); string[] s_id = ids.Split(','); //3 查询数据库 int rowsAffected = 0; for (int i = 1; i < s_id.Length; i++) { WhereClip nwhere = (tbMyfavorite._.ID == s_id[i] && tbMyfavorite._.UserID == OSession.Mem.ID); rowsAffected = DbSession.Default.Delete(nwhere); } //4 回应 if (rowsAffected > 0) { KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("The collected item is successfully deleted, and {0} records are deleted in total.", rowsAffected)); WriteXml(node, node2); return; } else { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Failed to delete the collected item. Please try again later."); WriteXml(node, node2); return; } } /// /// 删除下载中心记录 /// private static void DelMyDownloads() { if (!BLL.Mem.CheckPassport()) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "You are not currently a member, thus wishlist function is not available.
    Please log in or register."); WriteXml(node, node2); return; } //1 获取参数 string ids = GF("ids"); //2 检查参数 if (!ComUtls.CheckIDsFormat(ids)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Parameter error:ids"); WriteXml(node, node2); return; } //3 查询数据库 WhereClip nwhere = (tbDownloadLog._.ID.In(ids.Split(',')) && tbDownloadLog._.UserID == OSession.Mem.ID); int rowsAffected = DbSession.Default.Delete(nwhere); //4 回应 if (rowsAffected > 0) { KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("Download record is successfully deleted, {0} records are deleted in total.", rowsAffected)); WriteXml(node, node2); return; } else { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Failed to delete download record. Please try again later."); WriteXml(node, node2); return; } } /// /// 删除愿望夹 /// private static void DelMyWishs() { if (!BLL.Mem.CheckPassport()) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "You are not currently a member, thus wishlist function is not available.
    Please log in or register."); WriteXml(node, node2); return; } //1 获取参数 string ids = GF("ids"); //2 检查参数 if (!ComUtls.CheckIDsFormat(ids)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Parameter error:ids"); WriteXml(node, node2); return; } //3 查询数据库 WhereClip nwhere = (tbMyWish._.ID.In(ids.Split(',')) && tbMyWish._.UserID == OSession.Mem.ID); int rowsAffected = DbSession.Default.Delete(nwhere); //4 回应 if (rowsAffected > 0) { KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("The collected item is successfully deleted, and {0} records are deleted in total.", rowsAffected)); WriteXml(node, node2); return; } else { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Failed to delete the collected item. Please try again later."); WriteXml(node, node2); return; } } /// /// 添加收藏 /// private static void AddFav() { if (!BLL.Mem.CheckPassport()) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "You are not currently a member, thus favorite function is not available.
    Please log in or register."); WriteXml(node, node2); return; } string url = HttpUtility.HtmlEncode(GF("url")).ToLower(); string title = HttpUtility.HtmlEncode(GF("ptitle")); int columnId = ComUtls.ParseInt(GF("column_id"), 1); int uid = OSession.Mem.ID; int favCapability = OConfig.GlobalConfig.FavoriteCapacity; WhereClip whereClip = (tbMyfavorite._.UserID == OSession.Mem.ID); if (DbSession.Default.Count(whereClip) >= favCapability) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("Your favorites ({0}) is full, no item can be added any more. Please delete some existing collections before adding new collections." + "
    Add to favoritesView favorites", favCapability, OConfig.Common.Skin)); WriteXml(node, node2); return; } whereClip = (tbMyfavorite._.UserID == uid && tbMyfavorite._.URL == url); if (DbSession.Default.Exists(whereClip)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("The item already exists in your favorites.
    " + "Add to favoritesView favorites", OConfig.Common.Skin)); WriteXml(node, node2); return; } tbMyfavorite OBJ = new tbMyfavorite(); OBJ.ColumnID = columnId; OBJ.Enable = true; OBJ.InputTime = DateTime.Now; OBJ.PhotoPath = string.Empty; OBJ.Title = title; OBJ.UserID = uid; OBJ.URL = url; if (DbSession.Default.Save(OBJ) > 0) { KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("Successfully added to favorites。" + "
    Add to favoritesView favorites", OConfig.Common.Skin)); WriteXml(node, node2); return; } else { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Failed to add to favorites, please try again later."); WriteXml(node, node2); } } /// /// 删除收藏夹分类 /// private static void DelFavColumn() { int oid = ComUtls.ParseInt(GF("oid"), -1); KeyValuePair node; //1 检查ID if (oid < 1) { node = new KeyValuePair("state", "0"); WriteXml(node); return; } //2 删除 WhereClip nwhere = (tbMyFavoritesColumn._.ID == oid && tbMyFavoritesColumn._.UserName == OSession.Mem.Username); int rowsAffected = DbSession.Default.Delete(nwhere); //更新用户缓存 OCache.UserCache.FavoriteColumns = null; //3 回应 node = new KeyValuePair("state", rowsAffected > 0 ? "1" : "0"); WriteXml(node); } /// /// 取消订单 /// private static void CancelOrder() { string orderNo = GF("no"); WhereClip nwhere = (tbOrder._.OrderNo == orderNo && tbOrder._.UserName == OSession.Mem.Username && tbOrder._.isLock == false && tbOrder._.OrderState == (int)OEnum.OrderState.待审核1); Field[] nfields = new Field[] { tbOrder._.OrderState }; object[] nvals = new object[] { (int)OEnum.OrderState.已取消6 }; int rowsAffected = DbSession.Default.Update(nfields, nvals, nwhere); if (rowsAffected > 0) { KeyValuePair node1 = new KeyValuePair("state", "1"); WriteXml(node1); } else { KeyValuePair node1 = new KeyValuePair("state", "0"); WriteXml(node1); } } /// /// 初始化通用头部信息 /// private static void InitCommonHeader() { string username = BLL.Mem.GetUsername(); int cartGoodsCount = NSW.Cart.ProductCount; bool ShowIM = NSW.OConfig.GlobalConfig.ShowIM;//是否显示在线客服 KeyValuePair node1 = new KeyValuePair("username", username); KeyValuePair node2 = new KeyValuePair("prod_count", cartGoodsCount.ToString()); KeyValuePair node3 = new KeyValuePair("showIM", ShowIM.ToString()); WriteXml(node1, node2, node3); } /// /// 获取头部热门关键词 /// /// private static string GetHeaderKeywords() { StringBuilder sbRtnVal = new StringBuilder(); DataTable dt = OCache.HeaderKeywords; for (int i = 0; i < dt.Rows.Count; i++) { if (i != 0) { sbRtnVal.Append("||"); } string word = dt.Rows[i][tbKeyword._.Title.Name].ToString(); string url = dt.Rows[i][tbKeyword._.URL.Name].ToString(); sbRtnVal.AppendFormat("{0}$${1}", word, url); } return sbRtnVal.ToString(); } #region *** 会员注册 *** /// /// 检查用户名是否已注册 /// 回应:string /// * 1 - 成功 /// * 0 - 失败 /// private static void CheckUsername() { string s = GF("username").Trim(); if (s.Length == 0) { WriteString("0"); } if (!Regex.Match(s, @"^\w{3,16}$").Success) { WriteString("Username format error. The username must be 3 to 16 characters long (allowed characters: letter, number, underline)."); return; } if (DbSession.Default.Exists(tbUser._.UserName == s)) { WriteString("1"); } else { WriteString("0"); } } /// /// 检查电子邮箱地址是否已注册 /// 回应:string /// * 1 - 成功 /// * 0 - 失败 /// private static void CheckEmail() { string email = GF("email").Trim(); if (email.Length == 0) { WriteString("0"); } if (!ComUtls.CheckEmail(email)) { WriteString("0"); } if (DbSession.Default.Exists(tbUser._.UserEmail == email)) { WriteString("1"); } else { WriteString("0"); } } private static string APIRegister(string UserName, string email, string question, string answer, string password, string chnName, string province, string city, string birthday, string mphone, string address, string qq, string msn, string sex) { //系统整合API,同步论坛和博客会员等其他站点[不管对方数据库放在那里,不管对方站点的域名是什么] //李剑飞负责编写 NSW.Web.API.SyncUser syncUser = new NSW.Web.API.SyncUser(); string CAPI_Key = ""; //1>检查系统是否开启API整合,如果已经开启,则进行全站一点用户信息修改 if (!syncUser.API_Enable) { return "-1"; } //2>设置整合需要录入的参数,主要是修改XML文件[令牌] syncUser.prepareXML(true); CAPI_Key = NSW.Web.API.SyncUser.ShortMD5(UserName + syncUser.API_Key); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conAction).ToString(), "reguser"); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conUsername).ToString(), UserName); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conEmail).ToString(), email); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conQuestion).ToString(), question.Length > 0 ? question : "br"); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conAnswer).ToString(), answer.Length > 0 ? answer : StringUtls.Random(5, StringUtls.RandomStringMode.Letter)); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conPassword).ToString(), password); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conTruename).ToString(), chnName); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conProvince).ToString(), province); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conCity).ToString(), city); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conBirthday).ToString(), birthday); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conTelephone).ToString(), mphone); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conAddress).ToString(), address); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conQQ).ToString(), qq); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conMsn).ToString(), msn); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conGender).ToString(), sex); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conSex).ToString(), sex); syncUser.setNodeText(syncUser.sPE_Items.GetKey(syncUser.conSyskey).ToString(), CAPI_Key); //3>发送XML同步注册令牌,命令所有syncUser.API_Urls里面包含的子站点进行同步注册 syncUser.SendPost(); //4>如果出现用户信息修改错误,则返回错误信息,保证全站用户信息注册成功,只有syncUser.API_Urls里面包含的子站点全部用户信息注册成功,才算是用户信息注册成功 if (syncUser.FindError) { string s = string.Empty; for (int i = 0; i < syncUser.errorInfor.Count; i++) { s += syncUser.errorInfor[i].ToString(); } s = Gb2312ToUtf8(s); // WriteState(1, s); return s; } return "1"; //----------------------------------------------------------------- } private static string Gb2312ToUtf8(string str) { byte[] getBt = Encoding.GetEncoding("GB2312").GetBytes(str); getBt = System.Text.Encoding.Convert(Encoding.GetEncoding("GB2312"), Encoding.UTF8, getBt); return Encoding.GetEncoding("utf-8").GetString(getBt); } /// /// 会员注册 /// private static void Register() { if (ComUtls.IsForbiddenIP(OConfig.GlobalConfig.BlockToSubmitIPs, IP)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", ORes.Error.TheIpIsForbidToSubmitData); WriteXml(node, node2); return; } if (!BLL.OSecurity.CheckInterval(OSession.Common.LastPost, OConfig.GlobalConfig.GlobalSubmitDataInterval)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", ORes.Error.ToAvoidMaliceSubmittingPlsWaitAndResubmit); WriteXml(node, node2); return; } string username = GF("_username"); string pin = GF("_pin"); string email = GF("_email"); string verCode = GF("_verCode"); DateTime now = DateTime.Now; string secQus = GF("_secQus"); string secAsr = GF("_secAsr"); string realName = HttpUtility.HtmlEncode(GF("_realName")); int sex = ComUtls.ParseInt(GF("_sex"), -1); string birth = ComUtls.ParseDateTime(GF("_birth"), now).ToString("yyyy-MM-dd"); int edu = ComUtls.ParseInt(GF("_edu"), -1); string compName = HttpUtility.HtmlEncode(GF("_compName")); int industry = ComUtls.ParseInt(GF("_industry"), -1); int position = ComUtls.ParseInt(GF("_position"), -1); string mobile = GF("_mobile"); string tel = GF("_tel"); string fax = GF("_fax"); string province = HttpUtility.HtmlEncode(GF("_province")); // string city = HttpUtility.HtmlEncode(GF("_city")); string zipCode = GF("_zipCode"); string addr = HttpUtility.HtmlEncode(GF("_addr")); string hobby = HttpUtility.HtmlEncode(GF("_hobby")); string code = GF("_code"); WhereClip whereClip = null; //检查用户名 if (username.Length == 0) { WriteString("Username cannot be blank."); return; } if (!Regex.Match(username, @"^\w{3,16}$").Success) { WriteString("Username format error. The username must be 3 to 16 characters long (allowed characters: letter, number, underline)."); return; } whereClip = (tbUser._.UserName == username); if (DbSession.Default.Exists(whereClip)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("Sorry, the username {0} already exists, please try another.", username)); WriteXml(node, node2); return; } //检查电子邮箱地址 if (email.Length == 0) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "E-mail cannot be blank."); WriteXml(node, node2); return; } if (!ComUtls.CheckEmail(email)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "E-mail format error."); WriteXml(node, node2); return; } whereClip = (tbUser._.UserEmail == email); if (DbSession.Default.Exists(whereClip)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", string.Format("Sorry, E-mail address {0} already exists. Please try another one.", email)); WriteXml(node, node2); return; } //检查密码 if (!Regex.Match(pin, @"^.{6,16}$").Success) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Password format error. The password must be between 6 to 16 English characters long."); WriteXml(node, node2); return; } //check mobile no., tel. no. if (mobile.Length > 0 && !Regex.Match(mobile, @"^\d{11,13}$").Success) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Mobile number format error. The correct format should be a number with 11 to 13 digits."); WriteXml(node, node2); return; } if (tel.Length > 0 && !Regex.Match(tel, @"^\d{3,4}-\d{7,8}(-\d{1,5})?$").Success) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Telephone number format error. The correct format should be 0755-888888-123 (extension number is optional)."); WriteXml(node, node2); return; } if (fax.Length > 0 && !Regex.Match(fax, @"^\d{3,4}-\d{7,8}(-\d{1,5})?$").Success) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Fax number format error. The correct format should be 0755-888888-123 (extension number is optional)."); WriteXml(node, node2); return; } if (!CheckVerifyCode(verCode)) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", ORes.Error.VerifyCodeIsInvalidPlsRefreshAndTryAgain); WriteXml(node, node2); return; } tbUser OBJ = new tbUser(); OBJ.Active = true; OBJ.ActiveDate = now; OBJ.Address = addr; OBJ.Answer = (secQus.Length > 0 && secAsr.Length > 0) ? StringUtls.MD5(secAsr) : string.Empty; OBJ.ChnName = realName; //OBJ.City = city; OBJ.City = ""; OBJ.CompName = compName; OBJ.Enable = !OConfig.GlobalConfig.NeedActiveMembership; OBJ.Fax = fax; //行业ID,后期修改 OBJ.IndustryID = industry; //职位ID,后期修改 OBJ.JobID = position; OBJ.InputTime = now; OBJ.LastIP = string.Empty; OBJ.LastLogin = now; OBJ.Lock = false; OBJ.MPhone = mobile; OBJ.OrderID = 50; OBJ.Phone = tel; OBJ.Province = province; OBJ.Question = (secQus.Length > 0 && secAsr.Length > 0) ? secQus : string.Empty; OBJ.shortDesc = string.Empty; OBJ.UserBirthday = birth; OBJ.UserEmail = email; OBJ.UserFace = string.Empty; OBJ.UserLogins = 0; OBJ.UserMsg = string.Empty; OBJ.UserName = username; OBJ.UserPassword = StringUtls.MD5(pin); OBJ.UserPower = 0; OBJ.UserSex = sex; OBJ.UserWealth = 0; OBJ.ZipCode = zipCode; OBJ.Hobby = hobby; OBJ.EduID = edu; //会员组 tbUserGroup newBee = BLL.Mem.GetNewBeeUserGropu(); OBJ.UserGroup = newBee.Title; OBJ.UserGroupID = newBee.ID; //丰富内容 OBJ.UserCP = 0; OBJ.UserEP = 0; OBJ.IMMsn = string.Empty; OBJ.IMQQ = string.Empty; OBJ.HomeName = string.Empty; OBJ.ESN = string.Empty; OBJ.EUN = string.Empty; OBJ.EKN = string.Empty; OBJ.DomainName = string.Empty; OBJ.CustomeFields = string.Empty; //积分 OBJ.PointLoginIncreasingTime = DateTime.Now; OBJ.CumulativePoint = 0; //获取推荐人用户名 tbInviteLog nobjInviteLog = null; if (code.Length > 0) { nobjInviteLog = BLL.Mem.InviteConfirm(code); if (nobjInviteLog != null && !nobjInviteLog.isClose) { OBJ.CUserName = nobjInviteLog.Username; } } else { OBJ.CUserName = string.Empty; } //同步注册 string apiResult = APIRegister(username, email, secQus, secAsr, pin, OBJ.ChnName, OBJ.Province, OBJ.City, birth, OBJ.MPhone, OBJ.Address, OBJ.IMQQ, OBJ.IMMsn, OBJ.UserSex.ToString()); //同步注册状态 //1 成功 //-1 未启用API同步注册 //其它 有错误,则显示错误消息,注册中止 if (apiResult != "1" && apiResult != "-1") { WriteState(0, apiResult); return; } //继续网站注册操作 OEnum.RegisterResult result = BLL.Mem.Register(OBJ, pin, secAsr, nobjInviteLog); //操作结果 switch (result) { case NSW.OEnum.RegisterResult.Failed: { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Sorry, registration failed. Please try again later."); WriteXml(node, node2); } break; case NSW.OEnum.RegisterResult.NeedActivity: { //同步注册 APIRegister(username, email, secQus, secAsr, pin, OBJ.ChnName, OBJ.Province, OBJ.City, birth, OBJ.MPhone, OBJ.Address, OBJ.IMQQ, OBJ.IMMsn, OBJ.UserSex.ToString()); //记录最后提交数据的时间 OSession.Common.LastPost = DateTime.Now; //获取账号数字ID int uid = BLL.Mem.GetUIDByUsername(username); //更新邀请注册记录 if (nobjInviteLog != null) { nobjInviteLog.InvitedUsername = username; nobjInviteLog.RegisterUserEmail = OBJ.UserEmail; nobjInviteLog.isClose = true; nobjInviteLog.ActiveTime = OBJ.InputTime; nobjInviteLog.isActive = false; DbSession.Default.Save(nobjInviteLog); } KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node1 = new KeyValuePair("uid", uid.ToString()); KeyValuePair node2 = new KeyValuePair("username", username); KeyValuePair node3 = new KeyValuePair("email", email); KeyValuePair node4 = new KeyValuePair("msg", "
    Congratulations! Your account has been successfully registered!Your site passport is :
    " + "
    and your registered account number has been sent to your E-mail []
    " + "
    please check and activate your account.
    " + "
    " + "" + "" + "
    "); WriteXml(node, node1, node2, node3, node4); } break; case NSW.OEnum.RegisterResult.Successful: { //记录最后提交数据的时间 OSession.Common.LastPost = DateTime.Now; //注册成功后登录帐号 OEnum.Mem.LogingInResult loginResult = BLL.Mem.Login(username, pin, now, IP); //获取账号数字ID int uid = BLL.Mem.GetUIDByUsername(username); //奖励推荐人积分 if (nobjInviteLog != null) { BLL.Mem.AwardPreminumPoint(nobjInviteLog); } //新注册用户积分奖励 int cPoint = OConfig.GlobalConfig.PointRegister; if (cPoint > 0) { BLL.Mem.AwardPoint(username, cPoint, NSW.OEnum.PointChangingColumn.Award, "Reward points for newly registered users"); } KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node1 = new KeyValuePair("uid", uid.ToString()); KeyValuePair node2 = new KeyValuePair("username", username); KeyValuePair node3 = new KeyValuePair("email", email); KeyValuePair node4 = new KeyValuePair("msg", "
    Congratulations! Your account has been successfully registered!Your site passport is:
    " + "
    and your registered account number has been sent to your E-mail[]
    " + "
    Please check the E-mail, and your account has been Sign in.
    " + "
    " + "" + "" + "
    "); WriteXml(node, node1, node2, node3, node4); } break; } } #endregion /// /// 清空购物车 /// 回应:string /// * 1 - 成功 /// * 0 - 失败 /// private static void EmptyCart() { NSW.OSite.Cart.Cart.remove(); WriteString("1"); } /// /// 添加产品到购物车 /// 回应:XML对象 /// private static void AddToCart() { //1> 重建购物车 Cart cart = new Cart(); //2> 获取参数 int pid = ComUtls.ParseInt(GF("pid"), -1); int quti = ComUtls.ParseInt(GF("quti"), -1); string atts = GF("atts"); //3> 判断产品ID if (pid <= 0) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node1 = new KeyValuePair("msg", "Incorrect product ID."); KeyValuePair node2 = new KeyValuePair("count", NSW.Cart.ProductCount.ToString()); WriteXml(node, node1, node2); return; } //4> 查询产品是否存在 WhereClip whereClip = (VW_Product._.ID == pid && VW_Product._.Enable == true); VW_Product prodObj = DbSession.Default.Get(whereClip); if (prodObj == null) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node1 = new KeyValuePair("msg", "The product does not exist."); KeyValuePair node2 = new KeyValuePair("count", NSW.Cart.ProductCount.ToString()); WriteXml(node, node1, node2); return; } // 如果数量 > 0 则添加该产品到购物车,否则删除购物车里的该产品 if (quti > 0) { int salePromotionColumnId = OConfig.GlobalConfig.Product.SalesPromotionProductColumnID; //是否属于加码销售的产品 //如果是加码销售的产品,则要检查购物车里是否已经存在加码销售的产品,将存在的删除,因为一次购物只能购买一个加码销售的产品 if (prodObj.ColumnID == salePromotionColumnId) { // 查询数据库,查询商品 Field ClosingPriceField = VW_Product._.Price; WhereClip NWhere = (VW_Product._.Enable == true && VW_Product._.ShowTime < DateTime.Now && VW_Product._.ID.In(cart.ProductIDs.Split(','))); OrderByClip NOrder = (VW_Product._.Price.Asc); Field[] NField = new Field[]{ VW_Product._.ID, VW_Product._.ColumnID, VW_Product._.Price }; NSW.CartProductDetail cartProdDetail = new CartProductDetail(NWhere, NOrder, NField, ClosingPriceField); DataTable dt = cartProdDetail.ProductDataTable; foreach (DataRow row in dt.Rows) { int columnId = (int)row[VW_Product._.ColumnID.Name]; int prodId = (int)row[VW_Product._.ID.Name]; //获取单个产品购物车信息 CartProduct prodTemp = new CartProduct(); NSW.Cart.GetCartProductByProductID(cart.CartProductList, prodId, ref prodTemp); //如果是加码销售的产品 if (columnId == salePromotionColumnId) { cart.Add(prodId, 0, atts); break; } // end if } // end foreach } // end if CartProduct prod = new CartProduct(pid, quti,atts); cart.Add(prod); KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node1 = new KeyValuePair("msg", string.Format("

    {0} items have been added to your shopping cart

    Click “Pay now”

    ", quti, prodObj.Title)); KeyValuePair node2 = new KeyValuePair("quantity", cart.Quantity.ToString()); KeyValuePair node3 = new KeyValuePair("count", NSW.Cart.ProductCount.ToString()); WriteXml(node, node1, node2, node3); } else { //cart.RemoveOrderCrumb(pid); //KeyValuePair node = new KeyValuePair("state", "1"); //KeyValuePair node1 = new KeyValuePair("msg", string.Format("{0} 已从购物车移除。", prodObj.Title)); //KeyValuePair node2 = new KeyValuePair("count", NSW.Cart.ProductCount.ToString()); //WriteXml(node, node1, node2); CartProduct prod = new CartProduct(pid, quti,atts); cart.Add(prod); KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node1 = new KeyValuePair("msg", string.Format("{0} has been removed from shopping cart。", prodObj.Title)); KeyValuePair node2 = new KeyValuePair("count", NSW.Cart.ProductCount.ToString()); WriteXml(node, node1, node2); } } /// /// 删除购物车产品 /// private static void DelToCart() { //2> 获取参数 int pid = ComUtls.ParseInt(GF("pid"), -1); string atts = GF("atts"); NSW.OSite.Cart.Cart.delcart(pid, atts); KeyValuePair node = new KeyValuePair("state", "1"); KeyValuePair node1 = new KeyValuePair("msg", string.Format("{0} has been removed from shopping cart.", "Products selected")); KeyValuePair node2 = new KeyValuePair("count", NSW.OSite.Cart.Cart.countCart().ToString()); WriteXml(node, node1, node2); } /// /// 发表评论 /// private static void PostComment() { //1> 获取参数 int oid = ComUtls.ParseInt(GF("oid"), -1); string mark=GF("mark"); int columnId = 0; switch (mark) { case "news": columnId = 2; break; case "project": columnId = 3; break; case "download": columnId = 4; break; default: columnId = 1; break; } int integral = ComUtls.ParseInt(GF("integral"), 0); string content = StringUtls.RemoveTag(GF("content")); string email = GF("email"); string verCode = GF("verCode"); string username; int uid; if (BLL.Mem.CheckPassport()) { username = BLL.Mem.GetUsername(); uid = OSession.Mem.ID; } else { username = "Visitor"; uid = 0; } //2> 检查参数 SecurityCheck(verCode, CheckingType.BlockToSubmitIPs, CheckingType.ForbiddenIP, CheckingType.GlobalCommentabled, CheckingType.GlobalSubmittingFrequency, CheckingType.VerifyCode); if (oid < 1) { WriteString(ORes.Error.ObjectIDDoesNotExistOrIncorrect); return; } //if (columnId != 1 // || columnId != 2) //{ // KeyValuePair node = new KeyValuePair("state", "0"); // KeyValuePair node2 = new KeyValuePair("msg", "评论分类ID未知" + columnId); // WriteXml(node, node2); // return; //} if (integral < 0 || integral > 5) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "The grade is unreasonable"); WriteXml(node, node2); return; } if (StringUtls.GetStringLength(content) > 1000) { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "The content is too long. Please summarizie and submit again."); WriteXml(node, node2); return; } //3> 保存到数据库 tbComment nobj = new tbComment(); nobj.Content = BLL.Site.ReplaceBadWord(content); nobj.ColumnID = columnId; nobj.Enable = !OConfig.GlobalConfig.CheckComment; nobj.InputTime = DateTime.Now; nobj.Integral = integral; nobj.isCommend = false; nobj.LastIP = IP; nobj.OrderID = 50; nobj.Title = email; nobj.SubjectID = oid; nobj.UserID = uid; nobj.UserName = username; nobj.PointPosted = !OConfig.GlobalConfig.CheckComment; nobj.FeedBack = ""; int rowsAffected = DbSession.Default.Save(nobj); //4> 回应消息 if (rowsAffected > 0) { OSession.Common.LastPost = DateTime.Now; KeyValuePair node = new KeyValuePair("state", OConfig.GlobalConfig.CheckComment ? "2" : "1"); KeyValuePair node2 = new KeyValuePair("msg", "Successfully submitted, thank you for your participation." + (OConfig.GlobalConfig.CheckComment ? "Your comments will be displayed after administrator review." : string.Empty)); if (OConfig.GlobalConfig.CheckComment) { WriteXml(node, node2); } else { //奖励积分 if (username.Length > 0 && OConfig.GlobalConfig.PointPostingProductComment > 0) { BLL.Mem.AwardPostingProductCommentPoint(username); } //更新当前最新的评论次数 int num = DbSession.Default.From().Select(tbComment._.ID).Where(tbComment._.ColumnID == columnId && tbComment._.SubjectID == oid).Count(); KeyValuePair node3 = new KeyValuePair("time", ComUtls.FormatDateTime(nobj.InputTime)); KeyValuePair node4 = new KeyValuePair("comment", nobj.Content); KeyValuePair node5 = new KeyValuePair("ip", ComUtls.CutIp(nobj.LastIP, 2)); KeyValuePair node6 = new KeyValuePair("username", nobj.UserName); KeyValuePair node7 = new KeyValuePair("feedback", nobj.FeedBack); KeyValuePair node8 = new KeyValuePair("num", num.ToString()); WriteXml(node, node2, node3, node4, node5, node6, node7, node8); } return; } else { KeyValuePair node = new KeyValuePair("state", "0"); KeyValuePair node2 = new KeyValuePair("msg", "Failed to submit. Please try again later."); WriteXml(node, node2); } } /// /// 帮助中心满意度 /// private static void HelpSatisfaction() { //1> 获取参数 int oid = ComUtls.ParseInt(GF("oid"), -1); //2> 检查参数 if (oid < 1) { WriteString(ORes.Error.ObjectIDDoesNotExistOrIncorrect); return; } //3> 查询数据 WhereClip nwhere = (tbHelp._.Enable == true && tbHelp._.ID == oid); Field[] nfields = new Field[] { tbHelp._.HelpComplete, tbHelp._.HelpLess, tbHelp._.HelpSome }; DataTable dt = DbSession.Default .From() .Select(nfields) .Where(nwhere) .ToDataTable(1); if (dt.Rows.Count == 0) { WriteString(ORes.Error.ObjectDoesNotExist); return; } //4> 输出XML KeyValuePair key1 = new KeyValuePair("1", dt.Rows[0][tbHelp._.HelpComplete.Name].ToString()); KeyValuePair key2 = new KeyValuePair("2", dt.Rows[0][tbHelp._.HelpSome.Name].ToString()); KeyValuePair key3 = new KeyValuePair("3", dt.Rows[0][tbHelp._.HelpLess.Name].ToString()); WriteXml(key1, key2, key3); } /// /// 帮助中心满意度(帮助作用)反馈 /// private static void HelpUseful() { KeyValuePair key1 = new KeyValuePair(); KeyValuePair key2 = new KeyValuePair(); //1> 获取参数 string notion = GF("notion").ToLower(); int oid = ComUtls.ParseInt(GF("oid"), -1); //2> 判断参数 if (oid < 1) { return; } if (notion != "1" && notion != "2" && notion != "3") { return; } //3> 检查提交频率是否可疑 if (!BLL.OSecurity.CheckInterval(OSession.Common.LastPost, 15)) { key1 = new KeyValuePair("state", "0"); key2 = new KeyValuePair("msg", "Your opinion on satisfaction degree is submitted too frequently. Invalid submission, thank you for your participation."); WriteXml(key1, key2); return; } //4> 增加满意度 string fieldName; switch (notion) { case "1": fieldName = "HelpComplete"; break; case "2": fieldName = "HelpSome"; break; default: fieldName = "HelpLess"; break; } //事务处理 DbTran tran = DbSession.Default.BeginTran(); int rowsAffected = -1; int logRowsAffected = -1; try { string cmdText = string.Format("UPDATE {0} SET {1}={1}+1 WHERE [ID]={2}", ORes.OTableName.tbHelp, fieldName, oid); rowsAffected = tran.Excute(cmdText); tbHelpSurvery objHelpSurvery = new tbHelpSurvery(); objHelpSurvery.HelpComplete = (notion == "1"); objHelpSurvery.HelpID = oid; objHelpSurvery.HelpLess = (notion == "3"); objHelpSurvery.HelpSome = (notion == "2"); objHelpSurvery.InputTime = DateTime.Now; objHelpSurvery.UserIP = IP; objHelpSurvery.UserName = OSession.Mem.Username; logRowsAffected = tran.Save(objHelpSurvery); tran.Commit(); } catch { tran.Rollback(); } finally { tran.Close(); } //5> 回应消息 if (rowsAffected > 0) { OSession.Common.LastPost = DateTime.Now; key1 = new KeyValuePair("state", "1"); key2 = new KeyValuePair("msg", "Successfully submitted, thank you for your participation."); WriteXml(key1, key2); } else { OSession.Common.LastPost = DateTime.Now; key1 = new KeyValuePair("state", "0"); key2 = new KeyValuePair("msg", "Failed to submit. Please try again later."); WriteXml(key1, key2); } } /// /// 自增点击率 /// private static void Hits() { string tabNameMark = GF("mark").ToLower(); int oid = ComUtls.ParseInt(GF("oid"), -1); string tabName; if (oid < 1) { WriteString(ORes.Error.ObjectIDDoesNotExistOrIncorrect); return; } switch (tabNameMark) { case "help": tabName = ORes.OTableName.tbHelp; break; case "news": tabName = ORes.OTableName.tbNews; break; case "project": tabName = ORes.OTableName.tbProject; break; case "download": tabName = ORes.OTableName.tbDownload; break; #region ********************* 代理加盟 ************************** case "agent": tabName = ORes.OTableName.tbAgent; break; #endregion default: tabName = ORes.OTableName.tbProduct; break; } // end switch BLL.Site.IncreaseHits(oid, tabName); } #region ***常用对象*** /// /// 检查类型枚举 /// public enum CheckingType { ForbiddenIP = 1, BlockToSubmitIPs = 5, GlobalCommentabled = 2, VerifyCode = 3, GlobalSubmittingFrequency = 4 } /// /// 安全检查 /// /// 源验证码,如果不检查验证,则传递null /// 检查类型参数组 /// 检查是否通过 private static bool SecurityCheck(string verCode, params CheckingType[] checkingTypes) { //bool rtnVal = true; if (Contain(checkingTypes, CheckingType.ForbiddenIP)) { if (ComUtls.IsForbiddenIP(OConfig.GlobalConfig.ForbiddenIPs, IP)) { WriteState(0,ORes.Error.TheIpIsForbidToSubmitData); return false; } } if (Contain(checkingTypes, CheckingType.BlockToSubmitIPs)) { if (ComUtls.IsForbiddenIP(OConfig.GlobalConfig.BlockToSubmitIPs, IP)) { WriteState(0, ORes.Error.TheIpIsForbidden); return false; } } if (Contain(checkingTypes, CheckingType.GlobalCommentabled)) { if (!OConfig.GlobalConfig.Commentabled) { WriteState(0, ORes.Error.CommentIsClosedBySystem); return false; } } if (Contain(checkingTypes, CheckingType.GlobalSubmittingFrequency)) { if (!BLL.OSecurity.CheckSubmitFrequency(OConfig.GlobalConfig.GlobalSubmitDataInterval)) { WriteState(0, ORes.Error.ToAvoidMaliceSubmittingPlsWaitAndResubmit); return false; } } if (Contain(checkingTypes, CheckingType.VerifyCode) && verCode != null) { if (verCode.Length == 0) { WriteState(0, ORes.Error.VerifyCodeIsRequiredField); return false; } if (!CheckVerifyCode(verCode)) { WriteState(0, ORes.Error.VerifyCodeIsInvalidPlsRefreshAndTryAgain); return false; } } return true; } private static bool Contain(CheckingType[] checkingTypes, CheckingType checking) { foreach (CheckingType item in checkingTypes) { if (item == checking) return true; } return false; } /// /// 获取表单值Request.Form,获取失败则返回 string.Empty /// /// 参数名 /// 参数值 private static string GF(string paraName) { string val = HttpContext.Current.Request.Form[paraName]; return val == null ? string.Empty : val.Trim(); } /// /// 获取表单值Request.Form,获取失败则返回默认值 /// /// 参数名 /// 默认值 /// 参数值 private static string GF(string paraName, string defaultVal) { string val = HttpContext.Current.Request.Form[paraName]; return val == null ? defaultVal : val.Trim(); } /// /// 获取客户端IP地址 /// protected static string IP { get { return ComUtls.HostAddress; } } /// /// 检查验证码 /// /// 源验证码 /// 是否正确 protected static bool CheckVerifyCode(string verCode) { return BLL.OSecurity.CheckVerifyCode(verCode); } /// /// 输出 XML 对象 /// /// 节点 protected static void WriteXml(params KeyValuePair[] nodes) { string xmlCode = "" + "" + "{node}" + ""; StringBuilder sbNodes = new StringBuilder(); foreach (KeyValuePair node in nodes) { sbNodes.AppendFormat("{1}", node.Key, HttpUtility.HtmlEncode(node.Value)); } xmlCode = xmlCode.Replace("{node}", sbNodes.ToString()); HttpContext.Current.Response.ContentType = "text/xml"; HttpContext.Current.Response.Write(xmlCode); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); } /// /// 输出 XML 对象 /// /// 节点 protected static void WriteXml(string xml) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = "text/xml"; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; HttpContext.Current.Response.Write(xml); HttpContext.Current.Response.End(); //HttpContext.Current.Response.ContentType = "text/xml"; //HttpContext.Current.Response.Write(xml); //HttpContext.Current.Response.Flush(); //HttpContext.Current.Response.End(); } protected static void WriteXml(List> listNodes) { KeyValuePair[] nodes = new KeyValuePair[listNodes.Count]; for (int i = 0; i < listNodes.Count; ++i) { nodes[i] = listNodes[i]; } WriteXml(nodes); } /// /// 输出字符串 /// /// 字符串 protected static void WriteString(string str) { HttpContext.Current.Response.ContentType = "plain/text"; HttpContext.Current.Response.Write(str); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); } protected static void WriteString(string format, params object[] args) { WriteString(string.Format(format, args)); } public bool IsReusable { get { return false; } } #endregion #region 读取url参数值 /// /// 读取url参数值 /// /// /// /// private string GetUrlParams(string paramName, string defaultValue) { //string tmp = HttpContext.Current.Request[paramName]; //if (string.IsNullOrEmpty(tmp)) // return defaultValue; //return tmp.Replace("'", "''"); return QS(paramName, defaultValue); } /// /// 从 URL 解析参数[Request.QueryString],解析失败则返回 string.Empty /// /// 参数名 /// 参数值 protected static string QS(string paraName) { string s = HttpContext.Current.Request.QueryString[paraName]; return s == null ? string.Empty : s; } /// /// 从 URL 解析参数[Request.QueryString],解析失败则返回 默认值; /// /// 参数名 /// 默认值 /// 参数值 protected static string QS(string paraName, string defaultVal) { string s = HttpContext.Current.Request.QueryString[paraName]; return s == null ? defaultVal : s; } protected static string ClearGF(string paraName) { return HttpUtility.HtmlEncode(GF(paraName).Trim()); } /// /// 输出状态值与消息 /// /// 状态值 /// 消息 protected static void WriteState(int state, string msg) { KeyValuePair node = new KeyValuePair("state", state.ToString()); KeyValuePair node2 = new KeyValuePair("msg", msg); WriteXml(node, node2); } /// /// 获取格式化的错误消息字符串 /// /// 错误消息列表 /// protected static string GetError(List lstErr) { if (lstErr.Count == 0) { return string.Empty; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < lstErr.Count; i++) { if (i != 0) { sb.Append("$$"); } sb.Append(lstErr[i]); } return sb.ToString(); } #endregion } }