protected override void InitView() { base.InitView(); opid = GetReqParms("sd_key"); if (string.IsNullOrEmpty(opid)) { initUser(); } sd = DB.x_dict.FirstOrDefault(o => o.code == "user.sender" && o.jp == opid); if (sd == null && !Context.Request.RawUrl.Contains("/sder/bind.html")) { Context.Response.Redirect("/sder/bind.html"); } Context.Response.SetCookie(new HttpCookie("sd_key", opid)); isWx = Context.Request.UserAgent.Contains("MicroMessenger"); if (isWx) { initWx(); } }
protected override Web.Com.XResp Execute() { var q = from d in DB.x_dict where (d.name == name || d.value == value) && d.code == code select d; if (id > 0) { q = q.Where(o => o.dict_id != id); } if (!string.IsNullOrEmpty(upval)) { q = q.Where(o => o.upval == upval); } if (q.Count() > 0) { throw new XExcep("0x0007"); } x_dict dt = null; if (id > 0) { dt = DB.x_dict.FirstOrDefault(o => o.dict_id == id); } if (dt == null) { dt = new x_dict() { code = code } } ; dt.name = name; dt.value = value; dt.upval = string.IsNullOrEmpty(upval) ? "0" : upval; dt.jp = jp; dt.img = img; if (id == 0) { DB.x_dict.InsertOnSubmit(dt); } SubmitDBChanges(); CacheHelper.Remove("dict." + code); return(new XResp()); } }
protected override void InitApi() { base.InitApi(); var sd_key = GetReqParms("sd_key"); if (!string.IsNullOrEmpty(sd_key)) { sd = DB.x_dict.FirstOrDefault(o => o.code == "user.sender" && o.jp == sd_key); } if (sd == null) { throw new XExcep("0x0004"); } }
private void initCity() { var c = Tools.GetHttpData("http://int.dpool.sina.com.cn/iplookup/iplookup.php?ip=" + Tools.GetClientIP(), Encoding.GetEncoding("GB2312")); //1 - 1 - 1 中国 上海 上海 x_dict city = null; if (!string.IsNullOrEmpty(c) && c[0] == '1' && c.Length >= 6) { var cn = c.TrimEnd('\t').Split('\t').LastOrDefault(); city = DB.x_dict.FirstOrDefault(o => o.name == cn && o.code == "sys.city"); } if (city == null) { city = DB.x_dict.FirstOrDefault(o => o.name == "长沙" && o.code == "sys.city"); } city_id = long.Parse(city.value); city_name = city.name; }
protected override XResp Execute() { x_dict ent = null; if (id > 0) { ent = DB.x_dict.FirstOrDefault(o => o.dict_id == id); } if (ent == null) { ent = new x_dict() { code = "goods.cate" } } ; //var up = DB.x_dict.FirstOrDefault(o => o.code == "goods.cate" && o.value == upv); ent.name = name; ent.img = img; ent.jp = jp; ent.upval = upv; if (id == 0) { DB.x_dict.InsertOnSubmit(ent); } SubmitDBChanges(); if (string.IsNullOrEmpty(upv) || upv == "0") { ent.value = ent.dict_id + ""; } else { ent.value = upv + "-" + ent.dict_id; } SubmitDBChanges(); return(new XResp()); } }
protected override XResp Execute() { var d = db.GetDict("yt.dir", name); if (d != null) { throw new XExcep("T文件夹已经存在"); } d = new x_dict() { name = name, value = name, upval = "0", code = "yt.dir" }; db.x_dict.InsertOnSubmit(d); db.SubmitDBChanges(); db.ClearDict("yt.dir"); return(new XResp()); }
protected override XResp Execute() { x_dict ent = null; if (id > 0) { ent = DB.x_dict.FirstOrDefault(o => o.dict_id == id); } if (ent == null) { ent = new x_dict() { code = "user.level" } } ; ent.name = name; ent.img = img; ent.sort = sort; ent.f1 = off; ent.f2 = nd; ent.upval = "0"; if (ent.id == 0) { DB.x_dict.InsertOnSubmit(ent); } SubmitDBChanges(); ent.value = ent.id + ""; SubmitDBChanges(); CacheHelper.Remove("dict." + ent.code); return(new XResp()); } }
protected override XResp Execute() { x_dict ent = null; if (id > 0) { ent = DB.x_dict.FirstOrDefault(o => o.dict_id == id); } if (ent == null) { ent = new x_dict() { code = "user.sman", f4 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") } } ; ent.name = name; ent.img = img; ent.sort = 0; ent.f1 = (int)cityid; ent.f3 = tel; ent.upval = "0"; if (ent.id == 0) { DB.x_dict.InsertOnSubmit(ent); } SubmitDBChanges(); ent.value = ent.id + ""; SubmitDBChanges(); CacheHelper.Remove("dict." + ent.code); return(new XResp()); } }
protected override XResp Execute() { Context.Response.Headers.Add("Access-Control-Allow-Origin", "*"); if (DB.x_dict.Count(o => o.value == val && o.code == "sys.city") > 0) { throw new XExcep("T值已经存在", name + "," + val); } var ct = new x_dict() { name = name, value = val, code = "sys.city", img = "" }; if (!string.IsNullOrEmpty(up)) { var u = DB.x_dict.FirstOrDefault(o => o.value == up && o.code == "sys.city"); ct.upval = u.upval + "-" + val; } else { ct.upval = "0"; } DB.x_dict.InsertOnSubmit(ct); SubmitDBChanges(); return(new XResp() { msg = "成功" }); }
protected override XResp Execute() { x_dict ent = null; if (id > 0) { ent = DB.x_dict.FirstOrDefault(o => o.dict_id == id); } if (ent == null) { ent = new x_dict() { code = code } } ; ent.name = name; ent.f3 = no; ent.sort = sort; var upval = ent.upval; if (!string.IsNullOrEmpty(upv) && upv != "0") { var up = DB.x_dict.FirstOrDefault(o => o.code == code && o.value == upv); if (id > 0 && up.value.StartsWith(ent.upval)) { throw new XExcep("T不能将 " + name + " 调整到其下级里面"); } if (up.upval == "0") { ent.upval = up.value; } else { ent.upval = up.upval + "-" + up.value; } } else { ent.upval = "0"; } if (id > 0) { if (upval == "0") { var childs = DB.x_dict.Where(o => o.upval == ent.value); foreach (var e in childs.ToList()) { if (e.upval != ent.value) { e.upval = e.upval.Replace("-" + ent.value, ""); } } } else { var childs = DB.x_dict.Where(o => o.upval.StartsWith(upval + "-")); foreach (var e in childs.ToList()) { e.upval = e.upval.Replace("-" + ent.value, ""); } } } else { DB.x_dict.InsertOnSubmit(ent); SubmitDBChanges(); } ent.value = ent.dict_id + ""; SubmitDBChanges(); CacheHelper.Remove("dict." + ent.code); return(new XResp()); } }
protected override XResp Execute() { x_dict ent = null; if (id > 0) { ent = DB.x_dict.FirstOrDefault(o => o.dict_id == id); } if (ent == null) { ent = new x_dict() { code = code } } ; ent.name = name; ent.sort = sort; ent.jp = jp; if (upv > 0) { var up = DB.x_dict.FirstOrDefault(o => o.value == upv + ""); if (up == null) { ent.upval = "0"; } else if (up.upval == "0") { ent.upval = up.value; } else { ent.upval = up.upval + "-" + up.value; } } else { ent.upval = "0"; } if (ent.dict_id == 0) { DB.x_dict.InsertOnSubmit(ent); } if (val == 0) { SubmitDBChanges(); ent.value = ent.dict_id + ""; } else { ent.value = val + ""; } SubmitDBChanges(); CacheHelper.Remove("dict." + ent.code); return(new XResp()); } }