Ejemplo n.º 1
0
 private void BindGrid()
 {
     if (roleId > 0)
     {
         try
         {
             StringBuilder condition = new StringBuilder("WHERE U_DISABLED=0");  //去除用户为系统管理员
             condition.AppendFormat(" AND (SELECT COUNT(*) AS num FROM [S_ROLE_USER] b WHERE b.U_ID=a.U_ID AND R_ID={0})=0", roleId);
             string name = StringHelper.ClearSqlStringExSpace(ttbSearchUser.Text.Trim());
             if (name.Length > 0)
             {
                 condition.AppendFormat(" AND (U_NAME like'%{0}%' OR U_REALNAME like'%{0}%')", name);
             }
             int recordCount = 0;
             using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "U_ID,U_NAME,U_REALNAME,U_EMAIL,U_MOBILE", "[S_USER] a", condition.ToString(), "ORDER BY U_ID ASC", Grid1.PageIndex + 1, Grid1.PageSize, out recordCount))
             {
                 Grid1.RecordCount = recordCount;
                 Grid1.DataSource  = dt;
                 Grid1.DataBind();
             }
         }
         catch (Exception ex)
         {
             logger.Error("S.R.AddUser.BindGrid():Exception", ex);
             Alert.ShowInParent("系统错误。");
         }
         // 重新绑定表格数据之后,更新选中行
         FineUIGridCommon.UpdateSelectedRowIndexArray(hfSelectedIDS, Grid1);
     }
     else
     {
         // 参数错误,首先弹出Alert对话框然后关闭弹出窗口
         Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
     }
 }
Ejemplo n.º 2
0
        private void InitUserRole()
        {
            if (id > 0)
            {
                StringBuilder sbValue = new StringBuilder();
                StringBuilder sbText  = new StringBuilder();

                //初始化角色复选框列表的选择项
                using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "b.R_ID,b.R_NAME", "[S_ROLE_USER] a JOIN [S_ROLE] b ON a.R_ID=b.R_ID", "WHERE U_ID=" + id, "ORDER BY a.R_ID ASC"))
                {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (DataRow role in dt.Rows)
                        {
                            sbValue.AppendFormat("{0},", role["R_ID"]);
                            sbText.AppendFormat("{0},", role["R_NAME"]);
                        }

                        string roleValues = sbValue.ToString().TrimEnd(',');
                        string roleTexts  = sbText.ToString().TrimEnd(',');

                        tbSelectedRole.Text = roleTexts;
                        hfSelectedRole.Text = roleValues;
                    }
                }
            }
            string selectRoleURL = String.Format("SelectRole.aspx?ids=<script>{0}</script>", hfSelectedRole.GetValueReference());

            tbSelectedRole.OnClientTriggerClick = Window2.GetSaveStateReference(hfSelectedRole.ClientID, tbSelectedRole.ClientID)
                                                  + Window2.GetShowReference(selectRoleURL, "选择用户所属的角色");
        }
Ejemplo n.º 3
0
 //页面数据加载
 private void BindData()
 {
     try
     {
         StringBuilder condition = new StringBuilder();
         if (string.IsNullOrEmpty(this.ttbSearchUser.Text))
         {
             condition.Append("");
         }
         else
         {
             condition.Append(" where CName like'%" + this.ttbSearchUser.Text + "%' ");
         }
         int recordCount = 0;
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "*", "[view_person]", condition.ToString(), "ORDER BY CName asc", Grid1.PageIndex + 1, Grid1.PageSize, out recordCount))
         {
             Grid1.RecordCount = recordCount;
             Grid1.DataSource  = dt;
             Grid1.DataBind();
             FineUIGridCommon.UpdateSelectedRowIndexArray(hides, Grid1);
         }
     }
     catch (Exception ex)
     {
         logger.Error("X.MessageList.BindData():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 4
0
 private void BindData()
 {
     try
     {
         StringBuilder condition = new StringBuilder("WHERE 1=1");  //去除用户为系统管理员
         string        name      = StringHelper.ClearSqlStringExSpace(ttbSearchUser.Text.Trim());
         if (name.Length > 0)
         {
             condition.AppendFormat(" AND (U_NAME like'%{0}%' OR U_REALNAME like'%{0}%')", name);
         }
         string orderExp    = "ORDER BY " + Grid1.SortField + " " + Grid1.SortDirection;
         int    recordCount = 0;
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "U_ID,U_NAME,U_REALNAME,U_DISABLED,U_EMAIL,U_MOBILE,U_TEL,U_PREVLOGINTIME,U_PREVLOGINIP", "[S_USER]", condition.ToString(), orderExp, Grid1.PageIndex + 1, Grid1.PageSize, out recordCount))
         {
             Grid1.RecordCount = recordCount;
             Grid1.DataSource  = dt;
             Grid1.DataBind();
         }
     }
     catch (Exception ex)
     {
         logger.Error("S.U.Manage.BindData():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int mid = RequestHelper.GetQueryInt("menu", 0);
         if (mid > 0)
         {
             cookie = new RABCCookie();
             if (cookie == null)
             {
                 return;
             }
             if (cookie.UserName.Length == 0)
             {
                 return;
             }
             if (cookie.PurviewCodes.Length == 0)
             {
                 return;
             }
             code = cookie.PurviewCodes;
             using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "M_ID,M_PARENTID,M_NAME,M_CODE,M_LINK,M_ICON", "[S_MENU]", "WHERE M_ID<>" + mid + " AND M_PATH like '%," + mid + ",%' AND M_DISABLED=0", "ORDER BY M_ORDERID ASC"))
             {
                 if (dt != null && dt.Rows.Count > 0)
                 {
                     var source = dt.AsEnumerable();
                     ResolveSubTree(source, null, mid);
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
 private void LoadFirstMenu()
 {
     using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "M_ID,M_NAME,M_CODE", "[S_MENU]", "where M_PARENTID=0 AND M_DISABLED=0", "ORDER BY M_ORDERID ASC"))
     {
         if (dt != null && dt.Rows.Count > 0)
         {
             int index = 0;
             for (int i = 0, count = dt.Rows.Count; i < count; i++)
             {
                 if (VerifyPurview("," + dt.Rows[i]["M_CODE"] + ","))
                 {
                     if (index == 0)
                     {
                         Region2.IFrameUrl = "/leftmenu.aspx?menu=" + dt.Rows[i]["M_ID"];
                         menu.AppendFormat("<li class=\"on top_menu menu-{0}\"><a href=\"javascript:;\">{1}</a></li>", dt.Rows[i]["M_ID"], dt.Rows[i]["M_NAME"]);
                     }
                     else
                     {
                         menu.AppendFormat("<li class=\"top_menu menu-{0}\"><a href=\"javascript:;\">{1}</a></li>", dt.Rows[i]["M_ID"], dt.Rows[i]["M_NAME"]);
                     }
                     index++;
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
 private void BindGrid2()
 {
     try
     {
         if (roleId > 0)
         {
             using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "M_ID,M_NAME,M_CODE,M_LEVEL", "[S_MENU]", "WHERE M_DISABLED=0", "ORDER BY M_ORDERPATH ASC"))
             {
                 if (dt != null && dt.Rows.Count > 0)
                 {
                     purviewCodeData  = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "MPC_NAME,MPC_CODE,M_ID", "S_MENU_PURVIEWCODE", "WHERE MPC_DISABLED=0", "ORDER BY MPC_ID ASC");
                     Grid2.DataSource = dt;
                     Grid2.DataBind();
                     InitPermission();
                 }
             }
         }
         else
         {
             Alert.ShowInParent("参数错误!", String.Empty, ActiveWindow.GetHideReference());
         }
     }
     catch (Exception ex)
     {
         logger.Error("S.R.MManage.BindGrid2():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 8
0
 private void BindUser()
 {
     try
     {
         if (roleId > 0)
         {
             StringBuilder condition = new StringBuilder();
             condition.AppendFormat("WHERE R_ID={0}", roleId);
             string name = StringHelper.ClearSqlStringExSpace(ttbSearchUser.Text.Trim());
             if (name.Length > 0)
             {
                 condition.AppendFormat(" AND (U_NAME like'%{0}%' OR U_REALNAME like'%{0}%')", name);
             }
             int recordCount = 0;
             using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "a.U_ID,U_NAME,U_REALNAME,U_EMAIL,U_MOBILE,U_TEL", "[S_ROLE_USER] a JOIN [S_USER] b ON a.U_ID=b.U_ID", condition.ToString(), "ORDER BY a.U_ID DESC", gridUser.PageIndex + 1, gridUser.PageSize, out recordCount))
             {
                 gridUser.RecordCount = recordCount;
                 gridUser.DataSource  = dt;
                 gridUser.DataBind();
             }
         }
         else
         {
             Alert.ShowInParent("参数错误!", String.Empty, ActiveWindow.GetHideReference());
         }
     }
     catch (Exception ex)
     {
         logger.Error("S.R.UManage.BindUser():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 9
0
 private void BindData()
 {
     try
     {
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "M_ID,M_NAME,M_LEVEL,M_CODE,M_DISABLED", "[S_MENU]", String.Empty, "ORDER BY M_ORDERPATH ASC"))
         {
             Grid1.DataSource = dt;
             Grid1.DataBind();
         }
     }
     catch (Exception ex)
     {
         logger.Error("S.M.Manage.BindData():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 10
0
        public ActionResult GetAllButtonInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "id" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            if (!string.IsNullOrEmpty(Request["FButtonName"]) && !SqlInjection.GetString(Request["FButtonName"]))
            {
                strWhere += " and Name like '%" + Request["FButtonName"] + "%'";
            }
            //首先获取前台传递过来的参数
            int    pageindex  = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pagesize   = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            int    totalCount = 0; //输出参数
            string strJson    = JsonHelper.ToJson(SqlPagerHelper.GetPager("tbButton", "Id,Name,Code,Icon,Sort,Description,CreateTime,CreateBy,UpdateTime,UpdateBy", sort + " " + order, pagesize, pageindex, strWhere, out totalCount));

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
Ejemplo n.º 11
0
 private void BindRole()
 {
     try
     {
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "R_ID,R_NAME", "[S_ROLE]", String.Empty, "ORDER BY R_ORDERID ASC")) //去除系统管理员
         {
             cblRole.DataTextField  = "R_NAME";
             cblRole.DataValueField = "R_ID";
             cblRole.DataSource     = dt;
             cblRole.DataBind();
         }
     }
     catch (Exception ex)
     {
         logger.Error("S.U.SelectRole.BindRole():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "M_ID,M_NAME,M_LEVEL", "[S_MENU]", "WHERE M_DISABLED=0", "ORDER BY M_ORDERPATH ASC"))
         {
             if (dt != null && dt.Rows.Count > 0)
             {
                 ddlParentId.DataSource                 = dt;
                 ddlParentId.DataTextField              = "M_NAME";
                 ddlParentId.DataValueField             = "M_ID";
                 ddlParentId.DataSimulateTreeLevelField = "M_LEVEL";
                 ddlParentId.DataBind();
             }
         }
         ddlParentId.Items.Insert(0, new FineUI.ListItem("≡ 作为一级菜单 ≡", "0", true));
     }
 }
Ejemplo n.º 13
0
        private void LoadInfo()
        {
            int id = RequestHelper.GetRequestInt("id", 0);

            if (id > 0)
            {
                UserModel model = new UserBLL().GetModelById(id);
                if (model != null)
                {
                    labName.Text       = HttpUtility.HtmlDecode(model.Name);
                    labRealName.Text   = HttpUtility.HtmlDecode(model.RealName);
                    labEmail.Text      = HttpUtility.HtmlDecode(model.Email);
                    labMobile.Text     = HttpUtility.HtmlDecode(model.Mobile);
                    labPhone.Text      = HttpUtility.HtmlDecode(model.Tel);
                    imgShowStatus.Icon = model.Disabled ? Icon.Tick : Icon.BulletCross;
                    StringBuilder sbText = new StringBuilder();
                    using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "R_NAME", "[S_ROLE_USER] a JOIN [S_ROLE] b ON b.R_ID=a.R_ID", "WHERE a.U_ID=" + id, "ORDER BY a.R_ID ASC"))
                    {
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            foreach (DataRow role in dt.Rows)
                            {
                                sbText.AppendFormat("{0},", role["R_NAME"]);
                            }
                            labRole.Text = sbText.ToString().TrimEnd(',');
                        }
                    }
                    labPT.Text  = model.PrevLoginTime.HasValue ? model.PrevLoginTime.Value.ToString() : "";
                    labPIP.Text = HttpUtility.HtmlDecode(model.PrevLoginIP);
                    labLT.Text  = model.LastLoginTime.HasValue ? model.LastLoginTime.Value.ToString() : "";
                    labLIP.Text = HttpUtility.HtmlDecode(model.LastLoginIP);
                    labLTS.Text = model.LoginTimes.ToString();
                    labCT.Text  = model.CreateTime.Value.ToString();
                }
                else
                {
                    Alert.ShowInParent("读取数据失败!", String.Empty, ActiveWindow.GetHideReference());
                }
            }
            else
            {
                Alert.ShowInParent("参数错误!", String.Empty, ActiveWindow.GetHideReference());
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 public void BindData()
 {
     try
     {
         StringBuilder condition = new StringBuilder(" where Type='BD' ");
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, " HelpInfo ", "[MS_HelpPage]", condition.ToString(), ""))
         {
             if (dt.Rows.Count > 0)
             {
                 this.txtHelpInfo.Text = dt.Rows[0]["HelpInfo"].ToString();
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error("X.MessageList.BindData():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 15
0
        public ActionResult GetAllRequestionInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "id" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            if (!string.IsNullOrEmpty(Request["ftitle"]) && !SqlInjection.GetString(Request["ftitle"]))
            {
                strWhere += " and ftitle like '%" + Request["ftitle"] + "%'";
            }
            if (!string.IsNullOrEmpty(Request["frequstid"]) && !SqlInjection.GetString(Request["frequstid"]))
            {
                strWhere += " and ftypeid =" + Request["frequstid"];
            }

            //首先获取前台传递过来的参数
            int    pageindex  = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pagesize   = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            int    totalCount = 0;        //输出参数
            string strJson    = "";       //输出结果

            if (order.IndexOf(',') != -1) //如果有","就是多列排序(不能拿列判断,列名中间可能有","符号)
            {
                //多列排序:
                //sort:ParentId,Sort,AddDate
                //order:asc,desc,asc
                string   sortMulti  = "";              //拼接排序条件,例:ParentId desc,Sort asc
                string[] sortArray  = sort.Split(','); //列名中间有","符号,这里也要出错。正常不会有
                string[] orderArray = order.Split(',');
                for (int i = 0; i < sortArray.Length; i++)
                {
                    sortMulti += sortArray[i] + " " + orderArray[i] + ",";
                }
                strJson = JsonHelper.ToJson(SqlPagerHelper.GetPager("vw_requestion", "id,ftypeid,ftitle,fcontent,ftypename,fsort,CreateTime,CreateBy,UpdateTime,UpdateBy", sortMulti.Trim(','), pagesize, pageindex, strWhere, out totalCount));
            }
            else
            {
                strJson = JsonHelper.ToJson(SqlPagerHelper.GetPager("vw_requestion", "id,ftypeid,ftitle,fcontent,ftypename,fsort,CreateTime,CreateBy,UpdateTime,UpdateBy", sort + " " + order, pagesize, pageindex, strWhere, out totalCount));
            }
            var jsonResult = new { total = totalCount.ToString(), rows = strJson };

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="columns">要取的列名(逗号分开)</param>
        /// <param name="order">排序</param>
        /// <param name="pageSize">每页大小</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="where">查询条件</param>
        /// <param name="totalCount">总记录数</param>
        public string GetPager(string tableName, string columns, string order, int pageSize, int pageIndex, string where, out int totalCount)
        {
            DataTable dt = SqlPagerHelper.GetPager(tableName, columns, order, pageSize, pageIndex, where, out totalCount);

            dt.Columns.Add(new DataColumn("UserRoleId"));
            dt.Columns.Add(new DataColumn("UserRole"));
            dt.Columns.Add(new DataColumn("UserDepartmentId"));
            dt.Columns.Add(new DataColumn("UserDepartment"));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataTable dtrole       = new RoleBLL().GetRoleByUserId(Convert.ToInt32(dt.Rows[i]["ID"]));
                DataTable dtdepartment = new DepartmentBLL().GetDepartmentByUserId(Convert.ToInt32(dt.Rows[i]["ID"]));
                dt.Rows[i]["UserRoleId"]       = JsonHelper.ColumnToJson(dtrole, 0);
                dt.Rows[i]["UserRole"]         = JsonHelper.ColumnToJson(dtrole, 1);
                dt.Rows[i]["UserDepartmentId"] = JsonHelper.ColumnToJson(dtdepartment, 0);
                dt.Rows[i]["UserDepartment"]   = JsonHelper.ColumnToJson(dtdepartment, 1);
            }
            return(JsonHelper.ToJson(dt));
        }
Ejemplo n.º 17
0
 /// <summary>
 /// 绑定最后一条数据
 /// </summary>
 public void BindData()
 {
     try
     {
         StringBuilder condition = new StringBuilder("");
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "top 1 *", "[MS_Edition]", condition.ToString(), "ORDER BY createdtime desc"))
         {
             if (dt.Rows.Count > 0)
             {
                 this.txtNumber.Text  = dt.Rows[0]["version"].ToString();
                 this.txtEdition.Text = dt.Rows[0]["edition"].ToString();
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error("X.MessageList.BindData():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 18
0
        //页面数据加载
        private void BindData()
        {
            try
            {
                StringBuilder condition = new StringBuilder("");

                int recordCount = 0;
                using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "*", "[view_statistics]", condition.ToString(), "ORDER BY ID asc", Grid1.PageIndex + 1, Grid1.PageSize, out recordCount))
                {
                    Grid1.RecordCount = recordCount;
                    Grid1.DataSource  = dt;
                    Grid1.DataBind();
                }
            }
            catch (Exception ex)
            {
                logger.Error("X.MessageList.BindData():Exception", ex);
                Alert.ShowInParent("系统错误。");
            }
        }
Ejemplo n.º 19
0
 //页面数据加载
 private void BindData()
 {
     try
     {
         StringBuilder condition   = new StringBuilder("");
         string        id          = RequestHelper.GetRequestString("id", "");
         int           recordCount = 0;
         condition.AppendFormat("where Title_ID='{0}'", id);
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "*", "[TB_Comment]", condition.ToString(), "ORDER BY createdtime desc", Grid1.PageIndex + 1, Grid1.PageSize, out recordCount))
         {
             Grid1.RecordCount = recordCount;
             Grid1.DataSource  = dt;
             Grid1.DataBind();
         }
     }
     catch (Exception ex)
     {
         logger.Error("X.MessageList.BindData():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 20
0
 private void BindData()
 {
     txtID.Text          = "0";
     txtCode.Text        = String.Empty;
     txtName.Text        = String.Empty;
     chkDisabled.Checked = false;
     try
     {
         int recordCount = 0;
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "MPC_ID,MPC_NAME,MPC_CODE,MPC_DISABLED,M_NAME,M_CODE", "[S_MENU_PURVIEWCODE] mpc JOIN [S_MENU] m ON m.M_ID=mpc.M_ID", "WHERE mpc.M_ID=" + mid, "ORDER BY MPC_ID ASC", Grid1.PageIndex + 1, Grid1.PageSize, out recordCount))
         {
             Grid1.RecordCount = recordCount;
             Grid1.DataSource  = dt;
             Grid1.DataBind();
         }
     }
     catch (Exception ex)
     {
         logger.Error("S.M.PCManage.BindData():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 21
0
        //页面数据加载
        private void BindData()
        {
            try
            {
                id = RequestHelper.GetRequestString("id", "");
                StringBuilder condition = new StringBuilder("where 1=1");
                condition.AppendFormat(" and pageid='{0}' ", id);
                int recordCount = 0;

                using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "*", "[view_statistics_info]", condition.ToString(), " ORDER BY ID asc", Grid1.PageIndex + 1, Grid1.PageSize, out recordCount))
                {
                    Grid1.RecordCount = recordCount;
                    Grid1.DataSource  = dt;
                    Grid1.DataBind();
                }
            }
            catch (Exception ex)
            {
                logger.Error("X.MessageList.BindData():Exception", ex);
                Alert.ShowInParent("系统错误。");
            }
        }
Ejemplo n.º 22
0
 private void BindData()
 {
     try
     {
         StringBuilder condition = new StringBuilder("WHERE 1=1");
         string        key       = StringHelper.ClearSqlStringExSpace(ttbSearchKey.Text.Trim());
         if (key.Length > 0)
         {
             condition.AppendFormat(" AND [R_NAME] like '%{0}%'", key);
         }
         int recordCount = 0;
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "*", "[S_ROLE]", condition.ToString(), "ORDER BY R_ORDERID ASC", Grid1.PageIndex + 1, Grid1.PageSize, out recordCount))
         {
             Grid1.RecordCount = recordCount;
             Grid1.DataSource  = dt;
             Grid1.DataBind();
         }
     }
     catch (Exception ex)
     {
         logger.Error("S.R.Manage.BindData():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
Ejemplo n.º 23
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="columns">要取的列名(逗号分开)</param>
        /// <param name="order">排序</param>
        /// <param name="pageSize">每页大小</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="where">查询条件</param>
        /// <param name="totalCount">总记录数</param>
        public string GetPager(string tableName, string columns, string order, int pageSize, int pageIndex, string where, out int totalCount)
        {
            DataTable dt = SqlPagerHelper.GetPager(tableName, columns, order, pageSize, pageIndex, where, out totalCount);

            return(JsonHelper.ToJson(dt));
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 根据报名id查询数据
        /// </summary>
        /// <param name="mid">报名id</param>
        /// <param name="id">0参加1取消2全部</param>
        /// <param name="type">类型(-1所有取消的活动(赛事/培训),0、赛事1、培训2、约吧)</param>
        /// <returns></returns>
        public DataTable GetTableCancel(int mid, int id, int type, int page, int row, out int recordCount)
        {
            recordCount = 0;

            try
            {
                StringBuilder where = new StringBuilder();
                //  where.AppendFormat(" m_id ={0}  and isactivaty={1}", mids, type);

                StringBuilder order = new StringBuilder();
                order.AppendFormat(" order by App_Application.createtime desc");

                StringBuilder cmdText  = new StringBuilder();
                StringBuilder cmdtable = new StringBuilder();
                if (type == 2)
                {
                    cmdtable.Append("App_Application left join View_About on App_Application.a_id=View_About.ab_id");
                    cmdText.Append("ap_id,ab_id,pic,AnOrangepic,IosOrangepic,title,View_About.address,number,View_About.sex,numberlimit,movement,begintime,specifictime");
                    where.Append("App_Application.m_id=" + mid + " and App_Application.state not in('-1') and App_Application.type=" + type + "  ");
                }
                else
                {
                    cmdtable.Append(" App_Application left join View_Activaty on App_Application.a_id=View_Activaty.a_id");
                    cmdText.Append("ap_id,View_Activaty.a_id,pic,App_Application.state,AnOrangepic,IosOrangepic,title,View_Activaty.address,movement,praise,eventname,isactivaty,App_Application.modifytime");
                    if (type == -1)
                    {
                        where.Append("App_Application.m_id=" + mid + " and App_Application.state  in('2','3','4','5')   and App_Application.type in('0','1') ");
                    }
                    else
                    {
                        if (id == 0)
                        {
                            where.Append("App_Application.m_id=" + mid + " and App_Application.state=1  and App_Application.type=" + type + "  ");
                        }
                        else if (id == 1)
                        {
                            where.Append("App_Application.m_id=" + mid + " and App_Application.state in('2','3','4','5') and App_Application.type=" + type + " ");
                        }
                        else
                        {
                            where.Append("App_Application.m_id=" + mid + " and App_Application.state not in('-1','0') and App_Application.type=" + type + "  ");
                        }
                    }
                }


                return(SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, cmdText.ToString(), cmdtable.ToString(), where.ToString(), order.ToString(), page, row, out recordCount));
            }
            catch (ArgumentNullException ex)
            {
                logger.Error("调用方法GetTableCancel发生ArgumentNullException", ex);
            }
            catch (SqlException ex)
            {
                logger.Error("调用方法GetTableCancel发生SqlException", ex);
            }
            catch (Exception ex)
            {
                logger.Error("调用方法GetTableCancel发生Exception", ex);
            }
            return(null);
        }