public void Question_Add() { M_IServer isMod = new M_IServer(); isMod.UserId = mu.UserID; isMod.UserName = mu.UserName; isMod.Title = Request.Form["title_t"]; isMod.Content = Request.Form["txtContent"]; isMod.Priority = Request.Form["Priority"]; isMod.Type = Request.Form["Type"]; isMod.Root = "网页表单"; isMod.State = "未解决"; if (SafeSC.CheckIDS(Request.Form["CCUser_Hid"])) { isMod.CCUser = Request.Form["CCUser_Hid"]; } isMod.RequestTime = DataConverter.CDate(Request.QueryString["mydate_t"]); if (!string.IsNullOrEmpty(Request["OrderID"])) { isMod.OrderType = DataConverter.CLng(Request["OrderID"]); } isMod.Path = Request.Form["attach_hid"]; isMod.QuestionId = isBll.Insert(isMod); if (isMod.QuestionId > 0) { function.WriteSuccessMsg("提交成功", "FiServer?OrderID=" + isMod.OrderType); return; } else { function.WriteErrMsg("提交失败-可能是由于系统未开放功能所致"); return; } }
public bool DelByIds(string ids) { if (SafeSC.CheckIDS(ids)) { string sql = "Delete From " + TbName + " Where ID IN(" + ids + ")"; return(SqlHelper.ExecuteNonQuery(CommandType.Text, sql) > 0); } return(false); }
public bool ReBox(string ids) { if (SafeSC.CheckIDS(ids)) { string sql = "Update " + TbName + " Set Status=1 Where ID IN(" + ids + ")"; return(SqlHelper.ExecuteNonQuery(CommandType.Text, sql) > 0); } return(false); }
// 取消推荐问题 protected void BtnSubmit5_Click(object sender, EventArgs e) { string ids = Request.Form["idchk"]; if (SafeSC.CheckIDS(ids)) { askBll.UpdateByField("Elite", "0", ids); } MyBind(); }
public static PageSetting Order_Sel(Filter_Order filter) { string where = "OrderType!=" + (int)M_OrderList.OrderEnum.Hide; List <SqlParameter> sp = new List <SqlParameter>(); //是否包含回收站订单 if (filter.aside != -100) { where += " AND Aside=" + filter.aside; } #region 用户中心快速筛选 switch (filter.fast) { case "all": //全部(不含回收站) where += " AND Aside=0"; break; case "unpaid": //待付款==状态为未付款的 where += " AND PaymentStatus=" + (int)M_OrderList.PayEnum.NoPay; break; case "prepay": //已预付款(尚未支付尾款的订单) where += " AND Aside=0 AND Delivery=1 AND IsCount=0"; break; case "paid": //已支付(只支付了预付款的不在此列) where += " AND Aside=0 AND ((PaymentStatus=" + (int)M_OrderList.PayEnum.HasPayed + " AND Delivery=0) OR (Delivery=1 AND IsCount=1 AND Settle=1)) "; break; case "needpay": //需付款 where += " AND Aside=0 AND PaymentStatus=0"; break; case "receive": //需确认收货 where += " AND Aside=0 AND StateLogistics=1"; break; case "comment": //已付款未评价 //where += " AND (OrderStatus=" + (int)M_OrderList.StatusEnum.OrderFinish + " AND StateLogistics=" + (int)M_OrderList.ExpEnum.HasReceived + ")"; //where += " AND (SELECT COUNT(*) FROM ZL_CartPro WHERE Orderlistid=ID AND (AddStatus IS NULL OR AddStatus=''))>0";//AddStatus中会有退货记录,所以筛选为必须为空 //break; case "finish": //客户已付款收货 ||客户已完成退货 { where += string.Format(" AND ({0} OR {1})", "(OrderStatus=" + (int)M_OrderList.StatusEnum.OrderFinish + " AND StateLogistics=" + (int)M_OrderList.ExpEnum.HasReceived + ")", "(PaymentStatus=" + (int)M_OrderList.PayEnum.Refunded + ")"); } break; case "issure": where += " AND IsSure=0 "; break; case "recycle": //订单回收站 where = "OrderType!=" + (int)M_OrderList.OrderEnum.Hide + " AND Aside=1"; break; } #endregion #region 后台快速筛选 switch (filter.addon) { case "unpaid": //待付款==状态为未付款的 where += " AND PaymentStatus=" + (int)M_OrderList.PayEnum.NoPay; break; case "prepay": //已预付款(尚未支付尾款的订单) where += " AND Delivery=1 AND IsCount=0"; break; case "paid": where += " AND ((PaymentStatus=" + (int)M_OrderList.PayEnum.HasPayed + " AND Delivery=0) OR (Delivery=1 AND IsCount=1 AND Settle=1)) "; //where += " AND PaymentStatus=" + (int)M_OrderList.PayEnum.HasPayed; break; case "unexp": //待发货==已付款+未发货 where += " AND PaymentStatus=" + (int)M_OrderList.PayEnum.HasPayed + " AND StateLogistics=" + (int)M_OrderList.ExpEnum.NoSend; break; case "exped": //已发货==大于未发货状态的订单 where += " AND StateLogistics>" + (int)M_OrderList.ExpEnum.NoSend; break; case "finished": //where += " AND OrderStatus=" + (int)M_OrderList.StatusEnum.OrderFinish + " AND StateLogistics=" + (int)M_OrderList.ExpEnum.HasReceived; //后期移除,暂时支持预付 where += " AND (OrderStatus=" + (int)M_OrderList.StatusEnum.OrderFinish + " AND StateLogistics=" + (int)M_OrderList.ExpEnum.HasReceived + ")"; break; case "unrefund": where += " AND PaymentStatus=" + (int)M_OrderList.PayEnum.RequestRefund; break; case "refunded": where += " AND PaymentStatus=" + (int)M_OrderList.PayEnum.Refunded; break; case "recycle": //订单回收站==已关闭 where = " Aside=1 "; break; case "all": //全部(不含回收站) default: break; } #endregion //店铺类型 switch (filter.storeType) { case "all": break; case "store": where += " AND StoreID>0"; break; case "shop": where += " AND StoreID=0 "; break; default: if (DataConvert.CLng(filter.storeType) > 0) { where += " AND StoreID=" + DataConvert.CLng(filter.storeType) + " "; } break; } if (filter.isSure != -100) { where += " AND IsSure=" + filter.isSure; } //订单类型,未指定则抽出常规订单 if (string.IsNullOrEmpty(filter.orderType)) { where += " AND OrderType IN (0,1,4)"; } else if (filter.orderType.Equals("-100") || filter.orderType.Equals("-1")) { } else { SafeSC.CheckIDSEx(filter.orderType); where += " AND OrderType IN (" + filter.orderType + ")"; } //商品名,订单号,用户名,手机号,用户ids if (!string.IsNullOrEmpty(filter.proname)) { where += " AND ProName LIKE @proname"; sp.Add(new SqlParameter("proname", "%" + filter.proname + "%")); } if (!string.IsNullOrEmpty(filter.orderno)) { where += " AND OrderNo LIKE @orderno"; sp.Add(new SqlParameter("orderno", "%" + filter.orderno + "%")); } if (!string.IsNullOrEmpty(filter.reuser)) { where += " AND (Rename LIKE @reuser OR Receiver LIKE @reuser)"; sp.Add(new SqlParameter("reuser", "%" + filter.reuser + "%")); } if (!string.IsNullOrEmpty(filter.mobile)) { where += " AND MobileNum LIKE @mobile"; sp.Add(new SqlParameter("mobile", "%" + filter.mobile + "%")); } if (!string.IsNullOrEmpty(filter.uids) && SafeSC.CheckIDS(filter.uids)) { where += " AND Receiver IN (" + filter.uids + ")"; } //下单日期 if (!string.IsNullOrEmpty(filter.stime)) { DateTime result = DateTime.Now; if (DateTime.TryParse(filter.stime, out result)) { where += " AND AddTime>=@stime"; sp.Add(new SqlParameter("stime", result.ToString("yyyy/MM/dd 00:00:00"))); } } if (!string.IsNullOrEmpty(filter.etime)) { DateTime result = DateTime.Now; if (DateTime.TryParse(filter.etime, out result)) { where += " AND AddTime<=@etime"; sp.Add(new SqlParameter("etime", result.ToString("yyyy/MM/dd 23:59:59"))); } } //发货时间 if (!string.IsNullOrEmpty(filter.expstime) || !string.IsNullOrEmpty(filter.expetime)) { where += " AND ExpSTime IS NOT NULL "; } if (!string.IsNullOrEmpty(filter.expstime))//按发货日期筛选 { DateTime result = DateTime.Now; if (DateTime.TryParse(filter.expstime, out result)) { where += " AND ExpSTime>=@expstime"; sp.Add(new SqlParameter("expstime", result.ToString("yyyy/MM/dd 00:00:00"))); } } if (!string.IsNullOrEmpty(filter.expetime)) { DateTime result = DateTime.Now; if (DateTime.TryParse(filter.expetime, out result)) { where += " AND ExpSTime<=@expetime"; sp.Add(new SqlParameter("expetime", result.ToString("yyyy/MM/dd 23:59:59"))); } } //搜索,支持指定条件 if (!string.IsNullOrEmpty(filter.skey)) { sp.Add(new SqlParameter("skey", "%" + filter.skey + "%")); switch (filter.stype) { case "exp": where += " AND ExpressDelivery LIKE @skey"; break; case "oid": where += " AND ID= " + DataConvert.CLng(filter.skey); break; } } if (!String.IsNullOrEmpty(filter.oids)) { SafeSC.CheckIDSEx(filter.oids); where += " AND ID IN (" + filter.oids + ")"; } if (filter.payType != -100) { where += " AND PayType=" + filter.payType; } string view = "ZL_CartProView"; //只取订单的ID PageSetting setting = PageSetting.Single(filter.cpage, filter.psize, view, "ID", where, " GROUP BY ID ORDER BY ID DESC", sp, "ID"); DBCenter.SelPage(setting); string ids = ""; foreach (DataRow dr in setting.dt.Rows) { ids += dr["id"] + ","; } ids = ids.TrimEnd(','); setting.itemCount = DataConvert.CLng(DBCenter.Count("(SELECT ID FROM ZL_CartProView WHERE " + where + " GROUP BY ID) A", "", sp)); setting.pageCount = SqlBase.GetPageCount(setting.itemCount, setting.psize); //根据订单ID取出购物车中的数据,需要进行名称等筛选 if (!string.IsNullOrEmpty(ids)) { sp.Clear(); string cartWhere = "ID IN (" + ids + ") "; if (!string.IsNullOrEmpty(filter.proname)) { cartWhere += " AND ProName LIKE @proname"; sp.Add(new SqlParameter("proname", "%" + filter.proname + "%")); } setting.dt = DBCenter.Sel(view, cartWhere, "ID DESC", sp); } return(setting); }
//统一状态码 -1:失败,99:成功 //以下都限制为只能获取用户所在的公司 public void ProcessRequest(HttpContext context) { M_APIResult retMod = new M_APIResult(); retMod.retcode = M_APIResult.Failed; M_User_Plat upMod = null; string value = context.Request.Form["value"]; string result = ""; switch (Action) { case "plat_compuser": //获取公司中成员,用于@功能 { upMod = B_User_Plat.GetLogin(); DataTable dt = upBll.SelByCompWithAT(upMod.CompID); result = JsonHelper.JsonSerialDataTable(dt); OldRep(result); } break; case "getuinfo": //获取单个用户信息(只允许获取本公司),返回的信息存入Json,避免重复检测,后期将服务端也缓存化 { upMod = B_User_Plat.GetLogin(); int uid = Convert.ToInt32(value); M_User_Plat model = upBll.SelReturnModel(uid, upMod.CompID); if (model != null) { result = "{\"id\":\"" + model.UserID + "\",\"UserID\":\"" + model.UserID + "\",\"UserName\":\"" + model.TrueName + "\",\"Mobile\":\"" + model.Mobile + "\",\"GroupName\":\"" + model.GroupName.Trim(',') + "\",\"UserFace\":\"" + model.UserFace + "\"}"; } OldRep(result); } break; case "getnotify": //获取提醒 { B_Notify notBll = new B_Notify(); if (B_Notify.NotifyList.Count < 1) { retMod.retmsg = "none"; } else { notBll.RemoveExpire(); //去除超时的 M_UserInfo mu = new B_User().GetLogin(); List <M_Notify> list = notBll.GetNotfiyByUid(mu.UserID); DataTable retdt = new DataTable(); retdt.Columns.Add(new DataColumn("title", typeof(string))); retdt.Columns.Add(new DataColumn("content", typeof(string))); retdt.Columns.Add(new DataColumn("cuname", typeof(string))); if (list.Count > 0) { foreach (M_Notify model in list) //有多个就发多条 { notBll.AddReader(model, mu.UserID); DataRow dr = retdt.NewRow(); dr["title"] = model.Title; dr["content"] = model.Content; dr["cuname"] = model.CUName; retdt.Rows.Add(dr); } } retMod.retcode = M_APIResult.Success; retMod.result = JsonConvert.SerializeObject(retdt); } RepToClient(retMod); } break; case "newblog": //自己公司有无新的信息 { upMod = B_User_Plat.GetLogin(); result = msgBll.SelByDateForNotify(Req("date"), upMod).ToString(); OldRep(result); } break; case "privatesend": //私信功能,走邮件模块 { upMod = B_User_Plat.GetLogin(); if (upMod != null) { string msg = context.Request.Form["msg"]; string receuser = context.Request.Form["receuser"]; if (!string.IsNullOrWhiteSpace(msg) && !string.IsNullOrWhiteSpace(receuser) && SafeSC.CheckIDS(receuser)) { //过滤非用户公司的同事,后期处理 M_Message msgMod = new M_Message(); B_Message msgBll = new B_Message(); msgMod.Incept = receuser; msgMod.Sender = upMod.UserID.ToString(); msgMod.Title = upMod.TrueName + "的私信"; msgMod.PostDate = DateTime.Now; msgMod.Content = msg; msgMod.Savedata = 0; msgMod.Receipt = ""; msgMod.CCUser = ""; msgMod.Attachment = ""; msgBll.GetInsert(msgMod); result = "99"; //添加一条新提醒 B_Notify.AddNotify(upMod.UserName, "你收到一封私信", msgMod.Title, msgMod.Incept); } else { result = "-1"; } } else { result = "0"; } //未登录 OldRep(result); break; } case "addread": //阅读量统计 { string ids = context.Request.Form["ids"]; msgBll.AddRead(ids.Trim(',')); OldRep("1"); } break; } }
//common.ashx public ContentResult Common() { string value = GetParam("value"); string result = ""; string action = GetParam("action"); switch (action.ToLower()) { default: return(Content("未匹配接口")); case "plat_compuser": //获取公司中成员,用于@功能 { DataTable dt = upBll.SelByCompWithAT(upMod.CompID); result = JsonHelper.JsonSerialDataTable(dt); return(Content(result)); } case "getuinfo": //获取单个用户信息(只允许获取本公司),返回的信息存入Json,避免重复检测,后期将服务端也缓存化 { int uid = Convert.ToInt32(value); M_User_Plat model = upBll.SelReturnModel(uid, upMod.CompID); if (model != null) { result = "{\"id\":\"" + model.UserID + "\",\"UserID\":\"" + model.UserID + "\",\"UserName\":\"" + model.TrueName + "\",\"Mobile\":\"" + model.Mobile + "\",\"GroupName\":\"" + model.GroupName.Trim(',') + "\",\"UserFace\":\"" + model.UserFace + "\"}"; } return(Content(result)); } case "getnotify": //获取提醒 { //B_Notify notBll = new B_Notify(); //if (B_Notify.NotifyList.Count < 1) { retMod.retmsg = "none"; } //else //{ // notBll.RemoveExpire();//去除超时的 // List<M_Notify> list = notBll.GetNotfiyByUid(mu.UserID); // DataTable retdt = new DataTable(); // retdt.Columns.Add(new DataColumn("title", typeof(string))); // retdt.Columns.Add(new DataColumn("content", typeof(string))); // retdt.Columns.Add(new DataColumn("cuname", typeof(string))); // if (list.Count > 0) // { // foreach (M_Notify model in list)//有多个就发多条 // { // notBll.AddReader(model, mu.UserID); // DataRow dr = retdt.NewRow(); // dr["title"] = model.Title; // dr["content"] = model.Content; // dr["cuname"] = model.CUName; // retdt.Rows.Add(dr); // } // } // retMod.retcode = M_APIResult.Success; // retMod.result = JsonConvert.SerializeObject(retdt); //} return(Content(retMod.ToString())); } case "newblog": //自己公司有无新的信息 { result = msgBll.SelByDateForNotify(GetParam("date"), upMod).ToString(); return(Content(result)); } case "privatesend": //私信功能,走邮件模块 { if (upMod != null) { string msg = GetParam("msg"); string receuser = GetParam("receuser"); if (!string.IsNullOrWhiteSpace(msg) && !string.IsNullOrWhiteSpace(receuser) && SafeSC.CheckIDS(receuser)) { //过滤非用户公司的同事,后期处理 M_Message msgMod = new M_Message(); B_Message msgBll = new B_Message(); msgMod.Incept = receuser; msgMod.Sender = upMod.UserID; msgMod.Title = upMod.TrueName + "的私信"; msgMod.PostDate = DateTime.Now; msgMod.Content = msg; msgMod.Savedata = 0; msgMod.Receipt = ""; msgMod.CCUser = ""; msgMod.Attachment = ""; msgBll.GetInsert(msgMod); result = "99"; //添加一条新提醒 //B_Notify.AddNotify(upMod.UserName, "你收到一封私信", msgMod.Title, msgMod.Incept); } else { result = "-1"; } } else { result = "0"; } //未登录 return(Content(result)); } case "addread": //阅读量统计 { string ids = GetParam("ids"); string paraIds = ""; Dictionary <string, DateTime> dataValue; //为True说明ReadData中有该用户浏览记录 if (ReadData.TryGetValue(mu.UserID, out dataValue)) { //移除超时的记录并剔除IDS中在30s内浏览过的记录ID foreach (string id in ids.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)) { bool isRead = true; foreach (string key in new List <string>(dataValue.Keys)) { //移除超过30s的记录 if ((DateTime.Now - dataValue[key]).TotalMilliseconds > 30000) { dataValue.Remove(key); continue; } //30s内浏览过的内容不+阅读量 if (key.Contains("," + id + ",")) { isRead = false; break; } } if (isRead) { paraIds += id + ","; } } paraIds = paraIds.Trim(','); //保存本次浏览记录 if (!dataValue.ContainsKey("," + paraIds + ",")) { dataValue.Add("," + paraIds + ",", DateTime.Now); } } else { dataValue = new Dictionary <string, DateTime>(); paraIds = ids.Trim(','); dataValue.Add("," + paraIds + ",", DateTime.Now); //保存记录 ReadData.Add(mu.UserID, dataValue); } msgBll.AddRead(paraIds); return(Content("1")); } } }