public int KnowledgeOfCount(int orgid, int kns, bool?isUse) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(Knowledge._.Org_ID == orgid); } if (isUse != null) { wc.And(Knowledge._.Kn_IsUse == (bool)isUse); } if (kns > -1) { wc.And(Knowledge._.Kns_ID == kns); } return(Gateway.Default.Count <Knowledge>(wc)); }
/// <summary> /// 取友情链接 /// </summary> /// <param name="sortId">分类Id,如果为空则取所有</param> /// <param name="isShow"></param> /// <param name="isUse"></param> /// <param name="count">取多少条记录,如果小于等于0,则取所有</param> /// <returns></returns> public Links[] GetLinks(int orgid, int sortId, bool?isShow, bool?isUse, int count) { WhereClip wc = Links._.Org_ID == orgid; if (sortId > 0) { wc.And(Links._.Ls_Id == sortId); } if (isShow != null) { wc.And(Links._.Lk_IsShow == isShow); } if (isUse != null) { wc.And(Links._.Lk_IsUse == isUse); } return(Gateway.Default.From <Links>().Where(wc).OrderBy(Links._.Lk_Tax.Asc && Links._.Lk_Id.Asc).ToArray <Links>(count)); }
/// <summary> /// 获取所有简单调查的主题 /// </summary> /// <param name="isShow"></param> /// <param name="isUse"></param> /// <param name="count">如果小于等于0,则取所有</param> /// <returns></returns> public Vote[] GetSimpleTheme(bool?isShow, bool?isUse, int count) { WhereClip wc = Vote._.Vt_IsTheme == true && Vote._.Vt_Type == 1; if (isShow != null) { wc.And(Vote._.Vt_IsShow == isShow); } if (isUse != null) { wc.And(Vote._.Vt_IsUse == isUse); } if (count > 0) { return(Gateway.Default.From <Vote>().Where(wc).OrderBy(Vote._.Vt_CrtTime.Desc).ToArray <Vote>(count)); } return(Gateway.Default.From <Vote>().Where(wc).OrderBy(Vote._.Vt_CrtTime.Desc).ToArray <Vote>()); }
/// <summary> /// 获取教师的评价 /// </summary> /// <param name="thid">教师id</param> /// <param name="isUse"></param> /// <param name="count"></param> /// <returns></returns> public TeacherComment[] CommentCount(int thid, bool?isUse, bool?isShow, int count) { WhereClip wc = new WhereClip(); if (thid > 0) { wc.And(TeacherComment._.Th_ID == thid); } if (isUse != null) { wc.And(TeacherComment._.Thc_IsUse == (bool)isUse); } if (isShow != null) { wc.And(TeacherComment._.Thc_IsShow == (bool)isShow); } return(Gateway.Default.From <TeacherComment>().Where(wc).OrderBy(TeacherComment._.Thc_CrtTime.Desc).ToArray <TeacherComment>(count)); }
/// <summary> /// 删除所有 /// </summary> /// <param name="orgid">机构id</param> /// <param name="colid">栏目id</param> public void DownloadDeleteAll(int orgid, int colid) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(Download._.Org_ID == orgid); } if (colid > 0) { wc.And(Download._.Col_Id == colid); } Song.Entities.Download[] entities = Gateway.Default.From <Download>().Where(wc).ToArray <Download>(); foreach (Song.Entities.Download entity in entities) { DownloadDelete(entity); } }
/// <summary> /// 获取某个分厂的所有员工帐号; /// </summary> /// <param name="orgid">分厂id</param> /// <param name="isUse"></param> /// <param name="searTxt">员工名称</param> /// <returns></returns> public EmpAccount[] GetAll4Org(int orgid, bool?isUse, string searTxt) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(EmpAccount._.Org_ID == orgid); } if (isUse != null) { wc.And(EmpAccount._.Acc_IsUse == (bool)isUse); } if (!string.IsNullOrEmpty(searTxt) && searTxt != "") { wc.And(EmpAccount._.Acc_Name.Like("%" + searTxt + "%")); } return(Gateway.Default.From <EmpAccount>().Where(wc).OrderBy(EmpAccount._.Acc_EmpCode.Asc).ToArray <EmpAccount>()); }
public int SubjectOfCount(int orgid, bool?isUse, int pid) { WhereClip wc = new WhereClip(); if (orgid >= 0) { wc.And(Subject._.Org_ID == orgid); } if (isUse != null) { wc.And(Subject._.Sbj_IsUse == (bool)isUse); } if (pid >= 0) { wc.And(Subject._.Sbj_PID == pid); } return(Gateway.Default.Count <Subject>(wc)); }
public void ArticleDeleteAll(int orgid, int colid) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(Article._.Org_ID == orgid); } if (colid > 0) { wc.And(Article._.Col_Id == colid); } Song.Entities.Article[] entities = Gateway.Default.From <Article>().Where(wc).ToArray <Article>(); foreach (Song.Entities.Article entity in entities) { ArticleDelete(entity); } }
public Special[] SpecialCount(int orgid, bool?isShow, bool?isUse, int count) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(Special._.Org_ID == orgid); } if (isShow != null) { wc.And(Special._.Sp_IsShow == isShow); } if (isUse != null) { wc.And(Special._.Sp_IsUse == isUse); } return(Gateway.Default.From <Special>().Where(wc).OrderBy(Special._.Sp_Tax.Desc).ToArray <Special>(count)); }
/// <summary> /// 返回章节下所有事件 /// </summary> /// <param name="couid">课程ID</param> /// <param name="uid">章节的全局唯一值</param> /// <param name="type"></param> /// <param name="isUse"></param> /// <returns></returns> public OutlineEvent[] EventAll(int couid, string uid, int type, bool?isUse) { WhereClip wc = OutlineEvent._.Ol_UID == uid; if (couid > 0) { wc.And(OutlineEvent._.Oe_IsUse == (bool)isUse); } if (type > 0) { wc.And(OutlineEvent._.Oe_EventType == type); } if (isUse != null) { wc.And(OutlineEvent._.Oe_IsUse == (bool)isUse); } return(Gateway.Default.From <OutlineEvent>().Where(wc).OrderBy(OutlineEvent._.Oe_TriggerPoint.Asc).ToArray <OutlineEvent>()); }
/// <summary> /// 当前参数是否存在(通过参数名判断) /// </summary> /// <param name="entity"></param> /// <returns>如果已经存在,则返回true</returns> public bool IsExists(SystemPara entity) { WhereClip wc = new WhereClip(); wc.And(SystemPara._.Sys_Key == entity.Sys_Key); int obj = Gateway.Default.Count <SystemPara>(wc && SystemPara._.Sys_Id != entity.Sys_Id); return(obj > 0); }
public Knowledge[] KnowledgeCount(int orgid, bool?isUse, int kns, int count) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(Knowledge._.Org_ID == orgid); } if (isUse != null) { wc.And(Knowledge._.Kn_IsUse == (bool)isUse); } if (kns > -1) { wc.And(Knowledge._.Kns_ID == kns); } return(Gateway.Default.From <Knowledge>().Where(wc).OrderBy(Knowledge._.Kn_CrtTime.Desc).ToArray <Knowledge>(count)); }
/// <summary> /// 当前章节的试题 /// </summary> /// <param name="olid"></param> /// <param name="type"></param> /// <param name="isUse"></param> /// <param name="count"></param> /// <returns></returns> public Questions[] QuesCount(int olid, int type, bool?isUse, int count) { WhereClip wc = new WhereClip(); if (olid > 0) { wc.And(Questions._.Ol_ID == olid); } if (type > 0) { wc.And(Questions._.Qus_Type == type); } if (isUse != null) { wc.And(Questions._.Qus_IsUse == (bool)isUse); } return(Gateway.Default.From <Questions>().Where(wc).OrderBy(Questions._.Qus_ID.Desc).ToArray <Questions>(count)); }
public KnowledgeSort[] GetSortAll(int orgid, int couid, bool?isUse) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(KnowledgeSort._.Org_ID == orgid); } if (couid >= 0) { wc.And(KnowledgeSort._.Cou_ID == couid); } if (isUse != null) { wc.And(KnowledgeSort._.Kns_IsUse == (bool)isUse); } return(Gateway.Default.From <KnowledgeSort>().Where(wc).OrderBy(KnowledgeSort._.Kns_Tax.Asc).ToArray <KnowledgeSort>()); }
/// <summary> /// 删除所有 /// </summary> /// <param name="orgid">机构id</param> /// <param name="colid">栏目分类id</param> public void VideoDeleteAll(int orgid, int colid) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(Video._.Org_ID == orgid); } if (colid > 0) { wc.And(Video._.Col_Id == colid); } Song.Entities.Video[] entities = Gateway.Default.From <Video>().Where(wc).ToArray <Video>(); foreach (Song.Entities.Video entity in entities) { VideoDelete(entity); } }
/// <summary> /// 获取所有; /// </summary> /// <param name="orgid">机构id</param> /// <param name="platform">接口平台,电脑为web,手机为mobi</param> /// <param name="isEnable">是否允许</param> /// <returns></returns> public PayInterface[] PayAll(int orgid, string platform, bool?isEnable) { WhereClip wc = new WhereClip(); if (orgid > -1) { wc.And(PayInterface._.Org_ID == orgid); } if (!string.IsNullOrWhiteSpace(platform)) { wc &= PayInterface._.Pai_Platform == platform.ToLower(); } if (isEnable != null) { wc.And(PayInterface._.Pai_IsEnable == (bool)isEnable); } return(Gateway.Default.From <PayInterface>().Where(wc).OrderBy(PayInterface._.Pai_Tax.Asc).ToArray <PayInterface>()); }
public Article[] ArticlePager(int orgid, int?colid, string searTxt, bool?isVerify, bool?isDel, bool?isTop, bool?isHot, bool?isRec, bool?isImg, int size, int index, out int countSum) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(Article._.Org_ID == orgid); } if (colid > 0) { WhereClip wcColid = new WhereClip(); List <int> list = Business.Do <IColumns>().TreeID((int)colid); foreach (int l in list) { wcColid.Or(Article._.Col_Id == l); } wc.And(wcColid); } if (searTxt != null && searTxt.Trim() != "") { wc.And(Article._.Art_Title.Like("%" + searTxt + "%")); } if (isVerify != null) { wc.And(Article._.Art_IsVerify == (bool)isVerify); } if (isDel != null) { wc.And(Article._.Art_IsDel == (bool)isDel); } if (isTop != null) { wc.And(Article._.Art_IsTop == (bool)isTop); } if (isHot != null) { wc.And(Article._.Art_IsHot == (bool)isHot); } if (isRec != null) { wc.And(Article._.Art_IsRec == (bool)isRec); } if (isImg != null) { wc.And(Article._.Art_IsImg == (bool)isImg); } countSum = Gateway.Default.Count <Article>(wc); return(Gateway.Default.From <Article>().Where(wc).OrderBy(Article._.Art_PushTime.Desc).ToArray <Article>(size, (index - 1) * size)); }
public Product[] ProductCount(int orgid, int?colid, int count, bool?isDel, bool?isUse, string type) { WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(Product._.Org_ID == orgid); } if (colid != null && colid > 0) { wc.And(Product._.Col_Id == colid); } if (isDel != null) { wc.And(Product._.Pd_IsDel == isDel); } if (isUse != null) { wc.And(Product._.Pd_IsUse == isUse); } type = type.ToLower(); //排序方式 OrderByClip order = Product._.Pd_Tax.Asc; if (type == "new") { order = Product._.Pd_IsNew.Asc; wc.And(Product._.Pd_IsNew == true); } if (type == "hot") { order = Product._.Pd_Number.Desc; } if (type == "rec") { order = Product._.Pd_IsRec.Asc; } if (type == "flux") { order = Product._.Pd_Number.Desc; } //取产品数量 return(Gateway.Default.From <Product>().Where(wc).OrderBy(order && Product._.Pd_PushTime.Desc && Product._.Pd_Tax.Asc).ToArray <Product>(count)); }
public Team[] GetTeamPager(int depid, bool?isUse, string searTxt, int size, int index, out int countSum) { WhereClip wc = Team._.Team_ID > -1; if (depid > 0) { wc.And(Team._.Dep_ID == depid); } if (isUse != null) { wc.And(Team._.Team_IsUse == isUse); } if (searTxt != string.Empty) { wc.And(Team._.Team_Name.Like("%" + searTxt + "%")); } countSum = Gateway.Default.Count <Team>(wc); return(Gateway.Default.From <Team>().Where(wc).OrderBy(Team._.Team_Tax.Asc).ToArray <Team>(size, (index - 1) * size)); }
public Knowledge[] KnowledgePager(int orgid, bool?isUse, int kns, string searTxt, int size, int index, out int countSum) { WhereClip wc = Knowledge._.Org_ID == orgid; if (isUse != null) { wc.And(Knowledge._.Kn_IsUse == isUse); } if (kns > 0) { wc.And(Knowledge._.Kns_ID == kns); } if (searTxt != string.Empty) { wc.And(Knowledge._.Kn_Title.Like("%" + searTxt + "%")); } countSum = Gateway.Default.Count <Knowledge>(wc); return(Gateway.Default.From <Knowledge>().Where(wc).OrderBy(Knowledge._.Kn_CrtTime.Desc).ToArray <Knowledge>(size, (index - 1) * size)); }
/// <summary> /// 获取所有 /// </summary> /// <param name="isUse"></param> /// <returns></returns> public ProductFactory[] FactoryAll(bool?isUse) { WhereClip wc = ProductFactory._.Pfact_Id > 0; if (isUse != null) { wc.And(ProductFactory._.Pfact_IsUse == isUse); } return(Gateway.Default.From <ProductFactory>().Where(wc).OrderBy(ProductFactory._.Pfact_Id.Desc).ToArray <ProductFactory>()); }
/// <summary> /// 获取所有对象 /// </summary> /// <returns></returns> public OrganLevel[] LevelAll(bool?isUse) { WhereClip wc = new WhereClip(); if (isUse != null) { wc.And(OrganLevel._.Olv_IsUse == (bool)isUse); } return(Gateway.Default.From <OrganLevel>().Where(wc).OrderBy(OrganLevel._.Olv_Level.Desc).ToArray <OrganLevel>()); }
public ProductMessage[] GetProductMessagePager(string searTxt, bool?isAns, bool?isShow, int size, int index, out int countSum) { WhereClip wc = ProductMessage._.Pm_Id != -1; if (isAns != null) { wc.And(ProductMessage._.Pm_IsAns == isAns); } if (isShow != null) { wc.And(ProductMessage._.Pm_IsShow == isShow); } if (searTxt != null && searTxt.Trim() != "") { wc.And(ProductMessage._.Pm_Title.Like("%" + searTxt + "%")); } countSum = Gateway.Default.Count <ProductMessage>(wc); return(Gateway.Default.From <ProductMessage>().Where(wc).OrderBy(ProductMessage._.Pm_CrtTime.Desc).ToArray <ProductMessage>(size, (index - 1) * size)); }
/// <summary> /// 分页获取测试成绩 /// </summary> /// <param name="stid"></param> /// <param name="sbjid"></param> /// <param name="size"></param> /// <param name="index"></param> /// <param name="countSum"></param> /// <returns></returns> public TestResults[] ResultsPager(int stid, int sbjid, int couid, int size, int index, out int countSum) { WhereClip wc = TestResults._.Tr_ID > -1; if (stid > 0) { wc.And(TestResults._.Ac_ID == stid); } if (sbjid > 0) { wc.And(TestResults._.Sbj_ID == sbjid); } if (couid > 0) { wc.And(TestResults._.Cou_ID == couid); } countSum = Gateway.Default.Count <TestResults>(wc); return(Gateway.Default.From <TestResults>().Where(wc).OrderBy(TestResults._.Tr_CrtTime.Desc).ToArray <TestResults>(size, (index - 1) * size)); }
/// <summary> /// 获取对象;即所有分类; /// </summary> /// <returns></returns> public ProfitSharing[] ThemeAll(bool?isUse) { WhereClip wc = ProfitSharing._.Ps_IsTheme == true; if (isUse != null) { wc.And(ProfitSharing._.Ps_IsUse == (bool)isUse); } return(Gateway.Default.From <ProfitSharing>().Where(wc).OrderBy(ProfitSharing._.Ps_Level.Asc).ToArray <ProfitSharing>()); }
/// <summary> /// 某天内,学员给教师的评价数 /// </summary> /// <param name="thid">教师id</param> /// <param name="accid">学员id</param> /// <param name="day">当前天数</param> /// <returns></returns> public int CommentOfCount(int thid, int accid, int day) { WhereClip wc = new WhereClip(); if (thid > 0) { wc.And(TeacherComment._.Th_ID == thid); } if (accid > 0) { wc.And(TeacherComment._.Ac_ID == accid); } if (day > 0) { DateTime start = DateTime.Now.AddDays(-day); wc.And(TeacherComment._.Thc_CrtTime >= start); } return(Gateway.Default.Count <TeacherComment>(wc)); }
/// <summary> /// 当前分类的下级分类 /// </summary> /// <param name="pId">父级id,如果小于等0,仍作为0使用</param> /// <param name="isShow">是否显示</param> /// <returns></returns> public Navigation[] NaviChildren(int pid, bool?isShow) { WhereClip wc = Navigation._.Nav_PID == pid; if (isShow != null) { wc.And(Navigation._.Nav_IsShow == (bool)isShow); } return(Gateway.Default.From <Navigation>().Where(wc).OrderBy(Navigation._.Nav_Tax.Asc).ToArray <Navigation>()); }
/// <summary> /// 某天内,最近一次学员给教师的评价 /// </summary> /// <param name="thid">教师id</param> /// <param name="accid">学员id</param> /// <param name="day">当前天数</param> /// <returns></returns> public TeacherComment CommentSingle(int thid, int accid, int day) { WhereClip wc = new WhereClip(); if (thid > 0) { wc.And(TeacherComment._.Th_ID == thid); } if (accid > 0) { wc.And(TeacherComment._.Ac_ID == accid); } if (day > 0) { DateTime start = DateTime.Now.AddDays(-day); wc.And(TeacherComment._.Thc_CrtTime >= start); } return(Gateway.Default.From <TeacherComment>().Where(wc).OrderBy(TeacherComment._.Thc_CrtTime.Desc).ToFirst <TeacherComment>()); }
public Teacher[] Teacher4Sort(int sortid, bool?isUse) { WhereClip wc = Teacher._.Ths_ID == sortid; if (isUse != null) { wc.And(Teacher._.Th_IsUse == isUse); } return(Gateway.Default.From <Teacher>().Where(wc).ToArray <Teacher>()); }
public TeacherSort[] SortAll(int orgid, bool?isUse) { WhereClip wc = TeacherSort._.Org_ID == orgid; if (isUse != null) { wc.And(TeacherSort._.Ths_IsUse == isUse); } return(Gateway.Default.From <TeacherSort>().Where(wc).OrderBy(TeacherSort._.Ths_Tax.Asc).ToArray <TeacherSort>()); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; WorkInfoManager manager = new WorkInfoManager(); int currentPage = int.Parse(rp["pagenum"]); int pageSize = int.Parse(rp["pagesize"]) ; int count = 0, recordCount = 0; string workstatus = rp["Workstatus"]; WhereClip where = new WhereClip(); if (context.Session["AllDepart"] != null) { List<AdministrativeRegions> list = context.Session["AllDepart"] as List<AdministrativeRegions>; if (list != null && list.Count > 0) { string[] dparr = new string[list.Count]; for (int i = 0; i < list.Count; i++) { dparr[i] = list[i].ID.ToString(); } if (WhereClip.IsNullOrEmpty(where)) { where = ShebeiInfo._.SocrceDepart.In(dparr); } else { where = where && ShebeiInfo._.SocrceDepart.In(dparr); } } } if (!string.IsNullOrEmpty(workstatus)) { where.And(WorkInfo._.Status == workstatus); } if (!string.IsNullOrEmpty(context.Request["begindate"])) { string begin = context.Request["begindate"]; if (!string.IsNullOrEmpty(begin)) { where = where && WorkInfo._.CreateDate >= begin; } } if (!string.IsNullOrEmpty(context.Request["enddate"])) { string enddate = context.Request["enddate"]; if (!string.IsNullOrEmpty(enddate)) { where = where && WorkInfo._.CreateDate <= enddate; } } if (!string.IsNullOrEmpty(context.Request["username"])) { where = where && WorkInfo._.CurrentUser.Contains(context.Request["username"]); } if (!string.IsNullOrEmpty(context.Request["sbcode"])) { where = where && ShebeiInfo._.Code.Contains(context.Request["sbcode"]); } if (!string.IsNullOrEmpty(context.Request["sbname"])) { where = where && ShebeiInfo._.Name.Contains(context.Request["sbname"]); } OrderByClip or = WorkInfo._.CreateDate.Desc; if (!string.IsNullOrEmpty(context.Request["sortdatafield"])) { if (!string.IsNullOrEmpty(context.Request["sortorder"]) && context.Request["sortorder"] == "desc") { or = new OrderByClip(context.Request["sortdatafield"] + " desc"); } else { or = new OrderByClip(context.Request["sortdatafield"]); } } DataTable dt = manager.GetDataTable(currentPage + 1, pageSize, where, or, ref count, ref recordCount); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}"); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; if (context.Session["UserID"] != null) { string userid = context.Session["UserID"].ToString(); PersonInfo p = new PersonInfoManager().GetItemById(new Guid(userid)); if (!p.MarryStatus.HasValue || p.MarryStatus.Value != 3) { context.Response.Write("{\"total\":\"0\",\"rows\": 没有考勤数据}"); context.Response.End(); return; } } YuanGongKaoQinManager manager = new YuanGongKaoQinManager(); int pageNum = int.Parse(context.Request.QueryString.Get("pagenum")); int pagesize = int.Parse(context.Request.QueryString.Get("pagesize")); int recordCount = 0; WhereClip where = new WhereClip(); if (!string.IsNullOrEmpty(context.Request["USER"])) { where = YuanGongKaoQin._.UserName.Contains(context.Request["USER"]); } if (!string.IsNullOrEmpty(context.Request["begindate"])) { string begin = context.Request["begindate"]; if (!string.IsNullOrEmpty(begin)) { where = where && YuanGongKaoQin._.KQRQ >= begin; } } if (!string.IsNullOrEmpty(context.Request["enddate"])) { string enddate = context.Request["enddate"]; if (!string.IsNullOrEmpty(enddate)) { where = where && YuanGongKaoQin._.KQRQ <= enddate; } } if (!string.IsNullOrEmpty(context.Request["swstatus"])) { where = YuanGongKaoQin._.SWStatus == context.Request["swstatus"]; } if (!string.IsNullOrEmpty(context.Request["status"])) { where = YuanGongKaoQin._.Status == context.Request["status"]; } if (!string.IsNullOrEmpty(context.Request["KQRQ"])) { string[] datestr = context.Request["KQRQ"].ToString().Split('@'); string begin = datestr[0]; if (!string.IsNullOrEmpty(begin)) { where.And(YuanGongKaoQin._.KQRQ >= begin); } string end = datestr[1]; if (!string.IsNullOrEmpty(end)) { where.And(YuanGongKaoQin._.KQRQ <= end); } } string or = "UserName"; if (!string.IsNullOrEmpty(context.Request["sortdatafield"])) { if (!string.IsNullOrEmpty(context.Request["sortorder"]) && context.Request["sortorder"] == "desc") { or = context.Request["sortdatafield"] + " desc"; } else { or = context.Request["sortdatafield"]; } } DataTable dt = manager.GetDataTable(pageNum + 1, pagesize, where, or, ref pagesize, ref recordCount); //manager.GetDataTable(); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{\"total\":\"" + recordCount.ToString() + "\",\"rows\":" + result + "}"); context.Response.End(); }