| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- using System.Text;
- using System.IO;
- using XYFDRQ.Common;
- public partial class Business_WorkTimeOverSet : BasePage
- {
- XYFDRQ.BLL.T_Sys_UserAccount bll_T_Sys_UserAccount = new XYFDRQ.BLL.T_Sys_UserAccount();
- XYFDRQ.BLL.T_Sys_DictionaryValue bll_T_Sys_DictionaryValue = new XYFDRQ.BLL.T_Sys_DictionaryValue();
- protected void Page_Load(object sender, EventArgs e)
- {
- AjaxPro.Utility.RegisterTypeForAjax(typeof(Business_WorkTimeOverSet));
- if (!IsPostBack)
- {
- InitData();
- }
- }
- //提取信息 绑定信息
- [AjaxPro.AjaxMethod]
- public string LoadingData(AjaxPro.JavaScriptArray searchItems)
- {
- //searchItems0页码,1条数2类型3级别4状态
- string[] _operations = GetSearchItems(searchItems);
- string strSql =string.Empty;
- if (!string.IsNullOrEmpty(_operations[2]))
- {
- strSql += " and BusinessType=" + _operations[2];
- }
- if (!string.IsNullOrEmpty(_operations[3]))
- {
- strSql += " and InfoBigType=" + _operations[3];
- }
- if (!string.IsNullOrEmpty(_operations[4]))
- {
- strSql += " and State=" + _operations[4];
- }
- string ctrl = "~/Business/_controls/ctl_WorkTimeOverSet.ascx";
- Control uc_rep = LoadControl(ctrl);
- Repeater rptItems = (Repeater)uc_rep.FindControl("rptItems");
- XYFDRQ.DBUtility.Pagination pagination = new XYFDRQ.DBUtility.Pagination();//分页的类
- if (!string.IsNullOrEmpty(_operations[0]))
- pagination.Sequence = Convert.ToInt32(_operations[0]);
- else
- pagination.Sequence = 1;
- if (!string.IsNullOrEmpty(_operations[1]))
- pagination.PageSize = Convert.ToInt32(_operations[1]);
- else
- pagination.PageSize = 20;
- pagination.ItemUnit = "条记录";
- pagination.SortSentence = "ORDER BY T_Bus_TimeOver.Id DESC";
- pagination.Primarykey = "T_Bus_TimeOver.Id";
- pagination.SearchField = "*";
- pagination.TableName = "T_Bus_TimeOver";
- pagination.UrlStr = "";
- pagination.SearchSentence = strSql;
- pagination.ImagesPath = "../_grid/imgs/";
- try
- {
- rptItems.DataSource = pagination.GetDataTable();
- rptItems.DataBind();
- StringBuilder strb = new StringBuilder();
- StringWriter sw = new StringWriter(strb);
- HtmlTextWriter htw = new HtmlTextWriter(sw);
- pagination.GoPageBarStyle1();
- uc_rep.GetType().GetProperty("PaginationBar").SetValue(uc_rep, pagination.PageBar, null);
- rptItems.RenderControl(htw);
- return strb.ToString();
- }
- catch (Exception err) { return err.ToString(); }
- }
- /// <summary>
- /// 转化为数组
- /// </summary>
- /// <param name="searchItems"></param>
- /// <returns></returns>
- private string[] GetSearchItems(AjaxPro.JavaScriptArray searchItems)
- {
- int c = 0;
- if (searchItems != null)
- c = searchItems.Count;
- string[] operations = new string[c];
- int i = 0;
- foreach (Object obj in searchItems)
- {
- operations[i] = obj.ToString();
- i++;
- }
- return operations;
- }
- //绑定查询信息
- protected void InitData()
- {
-
- //绑定下拉列表
- BindDropList(this.ddlInfoType, "0");
- //绑定状态
- BindFromDictionary(this.ddlState, "GDZT");
- ////绑定业务等级
- //BindFromDictionary(this.ddlLevel, "GZDJ");
- }
- #region 绑定下拉列表
- private void BindDropList(DropDownList ddl,string parentType)
- {
- DataTable dt = new DataTable();
- try
- {
- ddl.Items.Clear();
- dt = new XYFDRQ.BLL.T_Bus_WorkType().GetList("ParentTypeId=" + parentType + " and IsDelete=0 order by Sort").Tables[0];
- foreach (DataRow dr in dt.Rows)
- {
- ddl.Items.Add(new ListItem(dr["TypeName"].ToString(), dr["TypeId"].ToString()));
- }
- ddl.Items.Insert(0, new ListItem("--全部--", ""));
- }
- catch (Exception ex)
- {
- SysLog.WriteLog(ex);
- }
- finally
- {
- dt.Clear();
- dt.Dispose();
- }
- }
- /// <summary>
- /// Ajax绑定业务类型
- /// </summary>
- /// <param name="ParentTypeId"></param>
- /// <returns></returns>
- [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
- public DataTable BindInfoType(string ParentTypeId)
- {
- DataTable dt = new DataTable();
- if (!string.IsNullOrEmpty(ParentTypeId))
- {
- dt = new XYFDRQ.BLL.T_Bus_WorkType().GetList("ParentTypeId=" + ParentTypeId + " and IsDelete=0 order by Sort").Tables[0];
- }
- return dt;
- }
- #endregion
- /// <summary>
- /// 从数据字典读取值
- /// </summary>
- /// <param name="ddl"></param>
- /// <param name="p_Condition"></param>
- private void BindFromDictionary(DropDownList ddl, string p_DictionaryFlag)
- {
- ddl.DataSource = bll_T_Sys_DictionaryValue.GetList("F_DictionaryFlag='" + p_DictionaryFlag + "' order by F_Sort");
- ddl.DataValueField = "F_ValueCode";
- ddl.DataTextField = "F_Name";
- ddl.DataBind();
- ddl.Items.Insert(0, new ListItem("--全部--", ""));
- }
- #region 删除操作
- [AjaxPro.AjaxMethod()]
- public string DeleteOpt(AjaxPro.JavaScriptArray arrItems)
- {
- string res = "error";
- try
- {
- string[] _operations = GetSearchItems(arrItems);
- string arrid = "";
- foreach (string oid in _operations)
- {
- arrid += "'" + oid + "',";
- }
- arrid += "#@!";
- arrid = arrid.Replace(",#@!", "").Replace("#@!", "");
- bool r = new XYFDRQ.BLL.T_Bus_TimeOver().DeleteList(arrid);
- if (r)
- {
- res = "success";
- }
- }
- catch (Exception ex)
- {
- XYFDRQ.Common.SysLog.WriteLog(ex);
- res = "error";
- }
- return res;
- }
- #endregion
- }
|