public virtual ActionResult DataTables(DataTableCriteria searchCriteria)
        {
            // Generate Data
            List <DataTableRecord> allRecords = new List <DataTableRecord>();

            int idCount   = 0;
            int cellCount = 0;

            for (int i = 0; i < 100; i++)
            {
                allRecords.Add(new DataTableRecord()
                {
                    Id = ++idCount, Column1 = "cell " + (++cellCount).ToString(), Column2 = "cell " + (++cellCount).ToString(), Column3 = "cell " + (++cellCount).ToString()
                });
            }

            // Apply search criteria to data
            var filteredRecord = allRecords.ApplyCriteria(searchCriteria);

            // TODO: Apply searching in the ApplyCriteria function eventually...
            if (!string.IsNullOrWhiteSpace(searchCriteria.GlobalSearchText))
            {
                filteredRecord = filteredRecord.Where(e => e.Column1.Contains(searchCriteria.GlobalSearchText) || e.Column2.Contains(searchCriteria.GlobalSearchText) || e.Column3.Contains(searchCriteria.GlobalSearchText)).ToList();
            }


            // Create response
            var result = new DataGridResult <DataTableRecord>();

            result.Data             = filteredRecord.ToList();
            result.DisplayedRecords = allRecords.Count();
            result.TotalRecords     = allRecords.Count();

            return(Json(result));
        }
        public virtual ActionResult DataTables(DataTableCriteria searchCriteria)
        {
            // Generate Data
            List<DataTableRecord> allRecords = new List<DataTableRecord>();

            int idCount = 0;
            int cellCount = 0;

            for (int i = 0; i < 100; i++)
                allRecords.Add(new DataTableRecord() { Id = ++idCount, Column1 = "cell " + (++cellCount).ToString(), Column2 = "cell " + (++cellCount).ToString(), Column3 = "cell " + (++cellCount).ToString() });

            // Apply search criteria to data
            var filteredRecord = allRecords.ApplyCriteria(searchCriteria);

            // TODO: Apply searching in the ApplyCriteria function eventually...
            if(!string.IsNullOrWhiteSpace(searchCriteria.GlobalSearchText))
                filteredRecord = filteredRecord.Where(e => e.Column1.Contains(searchCriteria.GlobalSearchText) || e.Column2.Contains(searchCriteria.GlobalSearchText) || e.Column3.Contains(searchCriteria.GlobalSearchText)).ToList();


            // Create response
            var result = new DataGridResult<DataTableRecord>();

            result.Data = filteredRecord.ToList();
            result.DisplayedRecords = allRecords.Count();
            result.TotalRecords = allRecords.Count();

            return Json(result);
        }
Esempio n. 3
0
        private void BindData()
        {
            string         id   = Request.QueryString["id"];
            CheckStockBLL  bll  = null;
            CheckStockBill info = new CheckStockBill();

            try
            {
                bll = BLLFactory.CreateBLL <CheckStockBLL>();
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.ID = id;
                    info    = bll.GetInfo(info);
                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value         = info.ID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                    this.BillDate.Text      = info.BillDate.ToString("yyyy-MM-dd");
                }


                this.IsConfirmName.Text = info.IsConfirm == 0 ? "未确认" : "已确认";

                //绑定明细
                DataGridResult <CheckStockDetail> matList = new DataGridResult <CheckStockDetail>();
                matList.Total = 0;
                matList.Rows  = info.Details;

                this.hiCheckList.Value = matList.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        private void BindData()
        {
            string          id   = Request.QueryString["id"];
            QualityCheckBLL bll  = null;
            WHQualityCheck  info = new WHQualityCheck();
            DataGridResult <WHQualityCheckResult> pList = new DataGridResult <WHQualityCheckResult>();

            try
            {
                bll = BLLFactory.CreateBLL <QualityCheckBLL>();
                int seq = 1;
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.ID = id;
                    info    = bll.Get(info);

                    UIBindHelper.BindForm(this.Page, info);
                    if (info.CheckResult == "0")
                    {
                        RB1.Checked = true;
                    }
                    else
                    {
                        RB2.Checked = true;
                    }
                    this.BillNoList.Items.Add(new ListItem(info.InStockBillNo, info.BillID));
                    this.BillNoList.SelectedValue = info.BillID;
                    this.BillNoList.Enabled       = false;
                    this.hiID.Value         = info.ID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                    List <WHQualityCheckResult> list = bll.GetResultList(id);
                    foreach (WHQualityCheckResult detail in list)
                    {
                        detail.DeleteAction = "deleteF(\'" + detail.FileName + "\')";

                        detail.DetailAction = "viewF(\'" + detail.FileName + "\')";
                        detail.SEQ          = seq++;
                    }
                    pList.Total = list.Count;
                    pList.Rows  = list;
                }
                else
                {
                    info             = new WHQualityCheck();
                    this.BillNO.Text = bll.GetNewBillNO();
                    info.CheckPerson = GetLoginInfo().UserName;
                    pList.Total      = 0;
                    pList.Rows       = new List <WHQualityCheckResult>();
                    UIBindHelper.BindForm(this.Page, info);
                }

                this.hiPList.Value = pList.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        private void BindData()
        {
            string         id  = Request.QueryString["id"];
            ProcessInfoBLL bll = null;

            Manage.Entity.MES.ProcessInfo info   = new Manage.Entity.MES.ProcessInfo();
            DataGridResult <EquipmentRef> eqList = new DataGridResult <EquipmentRef>();
            DataGridResult <StationRef>   wsList = new DataGridResult <StationRef>();

            try
            {
                bll = BLLFactory.CreateBLL <ProcessInfoBLL>();
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.PID = id;
                    info     = bll.Get(info);

                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value         = info.PID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                    List <EquipmentRef> eqlist = bll.GetEList(id);
                    foreach (EquipmentRef item in eqlist)
                    {
                        item.DeleteAction = "deleteEQ('" + item.EQID + "')";
                    }

                    List <StationRef> wslist = bll.GetSList(id);
                    foreach (StationRef item in wslist)
                    {
                        item.DeleteAction = "deleteWS('" + item.STID + "')";
                    }
                    wsList.Total = wslist.Count;
                    wsList.Rows  = wslist;

                    eqList.Total        = eqlist.Count;
                    eqList.Rows         = eqlist;
                    this.HiFLOWID.Value = info.FLOWID;
                }
                else
                {
                    string flowID = Request.QueryString["flowID"];
                    info         = new ProcessInfo();
                    info.FLOWID  = flowID;
                    wsList.Total = 0;
                    wsList.Rows  = new List <StationRef>();
                    eqList.Total = 0;
                    eqList.Rows  = new List <EquipmentRef>();
                }
                this.HiFLOWID.Value = info.FLOWID;
                this.hiWSList.Value = wsList.GetJsonSource();
                this.hiEQList.Value = eqList.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.IsPostBack == false)
     {
         DataGridResult <GoodPackingForm> matList = new DataGridResult <GoodPackingForm>();
         matList.Total        = 0;
         matList.Rows         = new List <GoodPackingForm>();
         this.hiMatList.Value = matList.GetJsonSource();
     }
 }
Esempio n. 7
0
        private void BindData()
        {
            string       id   = Request.QueryString["id"];
            OutStockBLL  bll  = null;
            OutStockBill info = new OutStockBill();

            try
            {
                bll = BLLFactory.CreateBLL <OutStockBLL>();
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.ID      = id;
                    info         = bll.GetInfo(info);
                    info.Details = info.Details.OrderBy(p => p.Seq).ToList();
                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value         = info.ID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiUPDATEUSER.Value = info.UPDATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                    this.btAdd.Visible      = false;
                    this.BillDate.Text      = info.BillDate.ToString("yyyy年MM月dd日");
                }
                else
                {
                    info               = new OutStockBill();
                    info.Details       = new List <OutStockDetail>();
                    this.BillNO.Text   = bll.GetNewBillNO();
                    this.BillDate.Text = DateTime.Now.ToString("yyyy年MM月dd日");
                }

                //绑定明细
                DataGridResult <OutStockDetail> matList = new DataGridResult <OutStockDetail>();
                matList.Total = 0;
                matList.Rows  = info.Details;

                foreach (OutStockDetail detail in info.Details)
                {
                    detail.UnitName    = string.IsNullOrEmpty(detail.UnitName) == false ? detail.UnitName : detail.MainUnitName;
                    detail.OutSpecName = string.IsNullOrEmpty(detail.OutSpecName) == false ? detail.OutSpecName : detail.SpecCode;
                    if (detail.OutAmount == 0)
                    {
                        detail.OutAmount = detail.MainUnitAmount;
                        detail.UnitName  = detail.MainUnitName;
                    }

                    detail.DeleteAction = "none";
                }

                this.hiMatList.Value = matList.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 8
0
        private void BindData()
        {
            string        id   = Request.QueryString["id"];
            SupplyInfoBLL bll  = null;
            SupplyInfo    info = new SupplyInfo();

            try
            {
                bll = BLLFactory.CreateBLL <SupplyInfoBLL>();
                if (!string.IsNullOrEmpty(id))
                {
                    info.PID     = id;
                    info         = bll.Get(info);
                    info.Details = bll.GetList(info.PID);
                    UIBindHelper.BindForm(this.Page, info);
                    this.FNAME.Text          = info.FactoryName;
                    this.PDNAME.Text         = info.ProduceName;
                    this.PLNAME.Text         = info.PLName;
                    this.DELIVERYDATE.Text   = info.DELIVERYDATE.ToString("yyyy-MM-dd");
                    this.REMARK.Text         = info.REMARK;
                    this.hiID.Value          = info.PID;
                    this.HiCREATEUSER.Value  = info.CREATEUSER;
                    this.HiCREATETIME.Value  = info.CREATETIME.ToString();
                    this.hiPlanID.Value      = info.PLANID;
                    this.PLNAME.Text         = info.PLName;
                    this.BatchNumber.Visible = true;
                    this.PLANID.Visible      = false;
                }
                else
                {
                    info                     = new SupplyInfo();
                    info.Details             = new List <SupplyMaterialInfo>();
                    this.BatchNumber.Visible = false;
                    this.PLANID.Visible      = true;
                }

                //绑定明细
                DataGridResult <SupplyMaterialInfo> supplyMaterialInfo = new DataGridResult <SupplyMaterialInfo>();
                supplyMaterialInfo.Total = info.Details.Count;
                supplyMaterialInfo.Rows  = info.Details;

                foreach (SupplyMaterialInfo detail in info.Details)
                {
                    detail.DeleteAction = "deleteItem(\'" + detail.MATRIALID + "\')";
                }

                this.hiMaterialList.Value = supplyMaterialInfo.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 9
0
        private void QueryTransformer_SQLUpdated(object sender, EventArgs e)
        {
            // Handle the event raised by Query Transformer object that the text of SQL query is changed
            // update the text box
            if (DataGridResult.QueryTransformer == null || !Equals(TabItemData, TabControl.SelectedItem))
            {
                return;
            }

            DataGridResult.FillData(DataGridResult.QueryTransformer.SQL);
            BoxSqlTransformer.Text = DataGridResult.QueryTransformer.SQL;
        }
Esempio n. 10
0
        public void TestGetResult()
        {
            var list     = Test2.CreateList();
            var result   = new DataGridResult(list, 2);
            var expected = new Str();

            expected.Add("{\"total\":2,\"rows\":[");
            expected.Add("{\"Id\":1,\"Name\":\"a\",\"Description\":\"a\"},");
            expected.Add("{\"Id\":2,\"Name\":\"b\",\"Description\":\"b\"}");
            expected.Add("]}");
            Assert.AreEqual(expected.ToString(), result.ToString());
        }
Esempio n. 11
0
    void QueryNode(int serverId, string nodeGuid)
    {
        try
        {
            GameServer server = TheAdminServer.GameServerManager.GetGameServer(serverId);
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }

            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();
            string        cmdText         = "SELECT NodeName,LeaderName,LayerId,NodeGUID,ChildCount FROM socialrelation {0}";

            searchCondition.AppendFormat("WHERE {0}='1' AND {1}='?'", FS2TableString.SocialrelationFieldTemplateId, FS2TableString.SocialrelationFieldParentGUID);
            paramList.Add(nodeGuid);

            SqlCommand cmd    = new SqlCommand(string.Format(cmdText, searchCondition.ToString()), paramList.ToArray());
            SqlResult  result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                DataGridResult.DataSource = CreateDataSource(result, serverId);
                if ((DataGridResult.DataSource as DataView).Table.Rows.Count == 0)
                {
                    LabelOpMsg.Text        = StringDef.NoMatchingRecord;
                    DataGridResult.Visible = false;
                    return;
                }
                else
                {
                    DataGridResult.DataBind();
                    DataGridResult.Visible = true;
                }
            }
            else
            {
                LabelOpMsg.Text        = StringDef.Query + StringDef.Failure;
                DataGridResult.Visible = false;
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text        = ex.Message;
            DataGridResult.Visible = false;
        }
    }
        private async Task GetItems()
        {
            isLoading = true;

            result = await DataService.GetItemsAsync(
                currentPage,
                currentItemsPerPage,
                currentSort,
                currentSearchQuery,
                Parameters);

            isLoading = false;
        }
Esempio n. 13
0
        private void BindData()
        {
            string         id   = Request.QueryString["id"];
            CheckStockBLL  bll  = null;
            CheckStockBill info = new CheckStockBill();

            try
            {
                bll = BLLFactory.CreateBLL <CheckStockBLL>();
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.ID = id;
                    info    = bll.GetInfo(info);
                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value         = info.ID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                    this.BillDate.Text      = info.BillDate.ToString("yyyy-MM-dd");

                    this.btConfirm.Visible = true;
                    this.btBuild.Visible   = false;
                }
                else
                {
                    info               = new CheckStockBill();
                    info.Details       = new List <CheckStockDetail>();
                    this.BillNO.Text   = bll.GetNewBillNO();
                    this.BillDate.Text = DateTime.Now.ToString("yyyy-MM-dd");

                    LoginInfo user = this.GetLoginInfo();
                    this.CheckHeader.SelectedValue = user.UserID;
                }

                this.IsConfirmName.Text = info.IsConfirm == 0 ? "未确认" : "已确认";

                //绑定明细
                DataGridResult <CheckStockDetail> matList = new DataGridResult <CheckStockDetail>();
                matList.Total = 0;
                matList.Rows  = info.Details.OrderBy(p => p.Seq).ToList();

                this.hiCheckList.Value = matList.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 14
0
    private void ListFile()
    {
        GameServer server = ServerDropDownList.SelectedGameServer;

        if (server != null)
        {
            //加入权限检查
            if (!WebUtil.CheckPrivilege(TheAdminServer.GameServerManager.SecurityObject, OpType.READ, Session))
            {
                LabelOpMsg.Text = StringDef.NotEnoughPrivilege;
                return;
            }
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            if (!server.DoPlugInAction(CurrentUser.Id, GameServerControl.PlugInGuid, GameServerControl.ActionKeyRefreshUploadDir, TextBoxPath.Text))
            {
                LabelOpMsg.Text = StringDef.OperationFail;
                return;
            }
            DataGridResult.DataSource = CreateDataSource(LoadFileInfo());
            if (DataGridResult.DataSource != null && (DataGridResult.DataSource as ICollection).Count != 0)
            {
                DataGridResult.Visible = true;
                DataGridResult.DataBind();
            }
            else
            {
                DataGridResult.Visible = false;
                LabelOpMsg.Text        = StringDef.NoFiles;
                return;
            }
        }
        else
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
        }
    }
Esempio n. 15
0
        private void BindData()
        {
            string        id   = Request.QueryString["id"];
            ProduceDOMBLL bll  = null;
            ProduceBOM    info = new ProduceBOM();

            try
            {
                bll = BLLFactory.CreateBLL <ProduceDOMBLL>();
                if (!string.IsNullOrEmpty(id))
                {
                    info.PID     = id;
                    info         = bll.Get(info);
                    info.Details = bll.GetList(info.PID);
                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value         = info.PID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                }
                else
                {
                    info         = new ProduceBOM();
                    info.Details = new List <BOMDetail>();
                }

                //绑定明细
                DataGridResult <BOMDetail> bomDetail = new DataGridResult <BOMDetail>();
                bomDetail.Total = info.Details.Count;
                bomDetail.Rows  = info.Details;

                foreach (BOMDetail detail in info.Details)
                {
                    detail.DeleteAction = "deleteItem(\'" + detail.MATRIALID + "\')";
                }

                this.hiBomDetailList.Value = bomDetail.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 16
0
        private List <DataGridResult> PopulateComparisonGrid(AppxPackageComparisonResult result)
        {
            List <DataGridResult> dataGridResult = new List <DataGridResult>();

            foreach (string fileHash in result.CrossPackageDeDupdFiles.Keys)
            {
                if (result.CrossPackageDeDupdFiles[fileHash].Count > 1)
                {
                    DataGridResult item = new DataGridResult()
                    {
                        FileName  = Path.GetFileName(result.CrossPackageDeDupdFiles[fileHash].First().FileName),
                        FileSize  = string.Format("{0:#,#}", result.CrossPackageDeDupdFiles[fileHash].First().UncompressedSize),
                        FileCount = result.CrossPackageDeDupdFiles[fileHash].Count.ToString(),
                    };
                    dataGridResult.Add(item);
                }
            }

            return(dataGridResult);
        }
Esempio n. 17
0
        /// <summary>
        /// 生成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btBuild_Click(object sender, EventArgs e)
        {
            CheckStockBill info = new CheckStockBill();
            CheckStockBLL  bll  = null;

            bll = BLLFactory.CreateBLL <CheckStockBLL>();

            info = bll.BuildBill(new CheckStockBill {
                Warehouse = this.Warehouse.SelectedValue, AreaID = this.AreaID.SelectedValue
            });

            this.BillNO.Text = info.BillNO;
            //绑定明细
            DataGridResult <CheckStockDetail> matList = new DataGridResult <CheckStockDetail>();

            matList.Total = 0;
            matList.Rows  = info.Details;

            this.hiCheckList.Value = matList.GetJsonSource();
        }
Esempio n. 18
0
        private void TabControl_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Execute a query on switching to the Data tab
            if (e.AddedItems.Count == 0 || _selectedConnection == null)
            {
                return;
            }

            if (QBuilder.SyntaxProvider == null || !Equals(e.AddedItems[0], TabItemData))
            {
                return;
            }

            CBuilder.Clear();
            BoxSqlTransformer.Text = BoxSql.Text;

            if (Equals(TabItemData, TabControl.SelectedItem))
            {
                DataGridResult.FillData(BoxSql.Text);
            }
        }
Esempio n. 19
0
        private void BindData()
        {
            string     id   = Request.QueryString["id"];
            UseMatBLL  bll  = null;
            UseMatBill info = new UseMatBill();

            try
            {
                bll = BLLFactory.CreateBLL <UseMatBLL>();
                if (!string.IsNullOrEmpty(id))
                {
                    info.PID = id;
                    info     = bll.Get(info);
                    UIBindHelper.BindForm(this.Page, info);
                    PDNAME.Text       = info.ProduceName;
                    FNAME.Text        = info.FactoryName;
                    REMARK.Text       = info.REMARK;
                    DELIVERYDATE.Text = info.DELIVERYDATE.ToString();
                }

                //绑定明细
                DataGridResult <UseMatAmount> supplyMaterialInfo = new DataGridResult <UseMatAmount>();
                supplyMaterialInfo.Total = info.Amounts.Count;
                supplyMaterialInfo.Rows  = info.Amounts;

                this.hiMaterialList.Value = supplyMaterialInfo.GetJsonSource();

                DataGridResult <UseMatDetail> details = new DataGridResult <UseMatDetail>();
                details.Total = info.Details.Count;
                details.Rows  = info.Details;

                this.hiUseMatList.Value = details.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 20
0
        private void BindData()
        {
            string       id   = Request.QueryString["id"];
            WorkGroupBLL bll  = null;
            WorkGroup    info = new WorkGroup();
            DataGridResult <WorkGroupRef> pList = new DataGridResult <WorkGroupRef>();

            try
            {
                bll = BLLFactory.CreateBLL <WorkGroupBLL>();
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.PID = id;
                    info     = bll.Get(info);

                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value         = info.PID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                    List <WorkGroupRef> list = bll.GetPList(id);
                    pList.Total = list.Count;
                    pList.Rows  = list;
                }
                else
                {
                    info        = new WorkGroup();
                    pList.Total = 0;
                    pList.Rows  = new List <WorkGroupRef>();
                }

                this.hiPList.Value = pList.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 21
0
        public override DataGridResult <ToDoListElement> execute(DataGridInput input)
        {
            ToDoListRequest request = new ToDoListRequest();

            request.UserInfo      = NavigationHandler.UserInfo;
            request.PageSize      = input.NumResForPage;
            request.RequestedPage = input.NumPage;
            request.IdGruppo      = NavigationHandler.RuoloInfo.IdGruppo;
            request.Registri      = NavigationHandler.Registri;
            if (!string.IsNullOrEmpty(input.IdParent))
            {
                request.ParentFolderId = input.IdParent;
            }
            ToDoListResponse resp = WSStub.getTodoList(request);
            DataGridResult <ToDoListElement> res = new DataGridResult <ToDoListElement>();

            res.NumTotResults = resp.TotalRecordCount;
            res.Elements      = new List <ToDoListElement>();
            foreach (ToDoListElement temp in resp.Elements)
            {
                res.Elements.Add(temp);
            }
            return(res);
        }
Esempio n. 22
0
        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_AddPerson_ClickAnsyc(object sender, RoutedEventArgs e)
        {
            Lib.MemberInfoEntity NewMamber    = new Lib.MemberInfoEntity();
            PageMemberPayFastWin WinAddMember = new PageMemberPayFastWin(NewMamber);

            if (WinAddMember.ShowDialog().Value == false)
            {
                return;
            }
            JToken TempJtoken = _CurViewModel.SalaryJArray.Where(x => x["身份证号"].ToString().Equals(NewMamber.Id)).FirstOrDefault();

            if (TempJtoken != null)
            {
                AppFuns.ShowMessage($"[{NewMamber.Name}]的已经存在。", "重复");
                return;
            }
            JToken NewJtoken = _CurViewModel.SalaryJArray.First.DeepClone();

            NewJtoken["身份证号"] = NewMamber.Id;
            NewJtoken["姓名"]   = NewMamber.Name;
            _CurViewModel.SalaryJArray.Add(NewJtoken);
            DataGridResult.SelectedIndex = DataGridResult.Items.Count - 1;
            DataGridResult.ScrollIntoView(DataGridResult.SelectedItem);
        }
Esempio n. 23
0
        // GET api/<controller>
        public IHttpActionResult Get()
        {
            var options = Request.GetQueryNameValuePairs()
                          .ToDictionary(x => x.Key, x => JsonConvert.DeserializeObject(x.Value));

            var db = new Database(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString, "System.Data.SqlClient");

            var agents       = db.From <Agents>("vwAgents");
            var agentFilterd = agents;
            //.FilterByOptions(options, out bool isFiltered)   //filtering
            //.SortByOptions(options)     //sorting
            //.PageByOptions(options);    //paging
            var data       = agentFilterd.ToList();
            int totalCount = agents.Count();/*isFiltered ? data.Count : agents.Count();*/
            var response   = new DataGridResult <Agents>
            {
                Data       = data,
                TotalCount = totalCount
            };

            return(Ok(response));

            //return new string[] { "value1", "value2" };
        }
        public ObservableCollection <DataGridResult> Execute()
        {
            var ColResult = new ObservableCollection <DataGridResult>();

            // 対局情報の編集
            foreach (var oneGame in ColGame)
            {
                if (oneGame.GameDate >= FindFrom && oneGame.GameDate <= FindTo)
                {
                    var oneSetting = ColRule.Where(item => item.ID == oneGame.SettingID).First();
                    var oneData    = new DataGridResult();
                    // 対局者を一人ずつ確認
                    // これまでに登場していなければオブジェクトを新規作成
                    #region 東家
                    if (ColResult.Where(item => item.ID == oneGame.East).Count() == 0)
                    {
                        oneData = new DataGridResult()
                        {
                            ID             = oneGame.East,
                            Name           = ColPerson.Where(item => item.ID == oneGame.East).First().Name,
                            GameCount      = 0,
                            TotalScore     = 0,
                            TotalScoreRate = 0.0
                        };
                        // コレクションに追加
                        ColResult.Add(oneData);
                    }

                    oneData                 = ColResult.Where(item => item.ID == oneGame.East).First();
                    oneData.GameCount      += 1;
                    oneData.TotalScore     += oneGame.EastScore;
                    oneData.TotalScoreRate += oneGame.EastScore * oneSetting.Rate * 1000;
                    #endregion

                    #region 南家
                    if (ColResult.Where(item => item.ID == oneGame.South).Count() == 0)
                    {
                        oneData = new DataGridResult()
                        {
                            ID             = oneGame.South,
                            Name           = ColPerson.Where(item => item.ID == oneGame.South).First().Name,
                            GameCount      = 0,
                            TotalScore     = 0,
                            TotalScoreRate = 0.0
                        };
                        // コレクションに追加
                        ColResult.Add(oneData);
                    }

                    oneData                 = ColResult.Where(item => item.ID == oneGame.South).First();
                    oneData.GameCount      += 1;
                    oneData.TotalScore     += oneGame.SouthScore;
                    oneData.TotalScoreRate += oneGame.SouthScore * oneSetting.Rate * 1000;
                    #endregion

                    #region 西家
                    if (ColResult.Where(item => item.ID == oneGame.West).Count() == 0)
                    {
                        oneData = new DataGridResult()
                        {
                            ID             = oneGame.West,
                            Name           = ColPerson.Where(item => item.ID == oneGame.West).First().Name,
                            GameCount      = 0,
                            TotalScore     = 0,
                            TotalScoreRate = 0.0
                        };
                        // コレクションに追加
                        ColResult.Add(oneData);
                    }

                    oneData                 = ColResult.Where(item => item.ID == oneGame.West).First();
                    oneData.GameCount      += 1;
                    oneData.TotalScore     += oneGame.WestScore;
                    oneData.TotalScoreRate += oneGame.WestScore * oneSetting.Rate * 1000;
                    #endregion

                    #region 北家
                    if (ColResult.Where(item => item.ID == oneGame.North).Count() == 0)
                    {
                        oneData = new DataGridResult()
                        {
                            ID             = oneGame.North,
                            Name           = ColPerson.Where(item => item.ID == oneGame.North).First().Name,
                            GameCount      = 0,
                            TotalScore     = 0,
                            TotalScoreRate = 0.0
                        };
                        // コレクションに追加
                        ColResult.Add(oneData);
                    }

                    oneData                 = ColResult.Where(item => item.ID == oneGame.North).First();
                    oneData.GameCount      += 1;
                    oneData.TotalScore     += oneGame.NorthScore;
                    oneData.TotalScoreRate += oneGame.NorthScore * oneSetting.Rate * 1000;
                    #endregion
                }
            }

            // 総得点の降順でソート
            ColResult = new ObservableCollection <DataGridResult>(ColResult.OrderByDescending(item => item.TotalScore));

            return(ColResult);
        }
Esempio n. 25
0
 protected void DataGridResutl_Cancel(Object sender, DataGridCommandEventArgs e)
 {
     DataGridResult.EditItemIndex = -1;
     DataGridResult.DataSource    = new DataView(Store);
     DataGridResult.DataBind();
 }
Esempio n. 26
0
        private void BindData()
        {
            string           id   = Request.QueryString["id"];
            QualityCheckBLL  bll  = null;
            QualityCheckInfo info = new QualityCheckInfo();
            DataGridResult <QualityCheckResult> pList = new DataGridResult <QualityCheckResult>();

            try
            {
                bll = BLLFactory.CreateBLL <QualityCheckBLL>();
                int seq = 0;
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.ID = id;
                    info    = bll.Get(info);
                    if (!string.IsNullOrEmpty(info.BatchNumber))
                    {
                        QualityCheckBLL  qcBll            = BLLFactory.CreateBLL <QualityCheckBLL>();
                        QualityCheckInfo qualityCheckInfo = qcBll.GetPDInfo(info.BatchNumber);
                        if (qualityCheckInfo != null)
                        {
                            info.PDDATE = qualityCheckInfo.PDDATE;
                            info.PDCODE = qualityCheckInfo.PDCODE;
                            info.PDNAME = qualityCheckInfo.PDNAME;
                        }
                    }
                    UIBindHelper.BindForm(this.Page, info);
                    if (info.CheckResult == "0")
                    {
                        RB1.Checked = true;
                    }
                    else
                    {
                        RB2.Checked = true;
                    }
                    this.BatchNumber.Enabled = false;
                    this.hiID.Value          = info.ID;
                    this.HiCREATEUSER.Value  = info.CREATEUSER;
                    this.HiCREATETIME.Value  = info.CREATETIME.ToString();
                    List <QualityCheckResult> list = bll.GetResultList(id);
                    foreach (QualityCheckResult detail in list)
                    {
                        detail.DeleteAction = "deleteF(\'" + detail.FileName + "\')";

                        detail.DetailAction = "viewF(\'" + detail.FileName + "\')";
                        detail.SEQ          = seq++;
                    }
                    pList.Total = list.Count;
                    pList.Rows  = list;
                }
                else
                {
                    info = new QualityCheckInfo();

                    info.CheckPerson = GetLoginInfo().UserName;
                    pList.Total      = 0;
                    pList.Rows       = new List <QualityCheckResult>();
                    UIBindHelper.BindForm(this.Page, info);
                }

                this.hiPList.Value = pList.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 27
0
    void Query()
    {
        try
        {
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();
            searchCondition.AppendFormat("WHERE {0}={1}", FS2TableString.LogFieldLogEvent, LogEvent.ExchangeItem);

            string itemName = TextBoxInputItemName.Text.Trim();
            if (itemName.Length != 0)
            {
                searchCondition.AppendFormat(" AND {0} LIKE '?'", FS2TableString.LogFieldLogData);
                if (CheckBoxItemName.Checked)
                {
                    paramList.Add(string.Format("%“{0}”%", itemName));
                }
                else
                {
                    paramList.Add(string.Format("%“%{0}%”%", itemName));
                }
            }

            string giverName = TextBoxInputGiver.Text.Trim();
            if (giverName.Length != 0)
            {
                if (CheckBoxGiver.Checked)
                {
                    searchCondition.AppendFormat(" AND {0} IN ({1})", FS2TableString.LogFieldLogKey1,
                                                 string.Format("SELECT {0} FROM {1} WHERE {2}='?'", FS2TableString.RolesfirstFieldGUID,
                                                               FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldRoleName));
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} IN ({1})", FS2TableString.LogFieldLogKey1,
                                                 string.Format("SELECT {0} FROM {1} WHERE {2} LIKE '%?%'", FS2TableString.RolesfirstFieldGUID,
                                                               FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldRoleName));
                }
                paramList.Add(giverName);
            }

            string receiverName = TextBoxInputReceiver.Text.Trim();
            if (receiverName.Length != 0)
            {
                if (CheckBoxReceiver.Checked)
                {
                    searchCondition.AppendFormat(" AND {0} IN ({1})", FS2TableString.LogFieldLogKey3,
                                                 string.Format("SELECT {0} FROM {1} WHERE {2} = '?'", FS2TableString.RolesfirstFieldGUID,
                                                               FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldRoleName));
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} IN ({1})", FS2TableString.LogFieldLogKey3,
                                                 string.Format("SELECT {0} FROM {1} WHERE {2} LIKE '%?%'", FS2TableString.RolesfirstFieldGUID,
                                                               FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldRoleName));
                }
                paramList.Add(receiverName);
            }

            _start = StartDate.SelectedDate;
            if (_start == DateTime.MinValue)
            {
                LabelOpMsg.Text = StringDef.ParameterInputError;
                return;
            }
            _end = EndDate.SelectedDate;
            if (_end == DateTime.MinValue)
            {
                LabelOpMsg.Text = StringDef.ParameterInputError;
                return;
            }
            searchCondition.Append(string.Format(" AND {0}>='{1}' AND {0}<'{2}'", FS2TableString.LogFieldLogTime, _start.ToString("yyyy-MM-dd HH:mm:ss"), _end.ToString("yyyy-MM-dd HH:mm:ss")));

            string baseCmdString = string.Format("SELECT LogKey1,LogKey3,LogData,LogTime FROM {0} {1}",
                                                 "{0}", searchCondition.ToString());
            string addTableCmdString;
            WebUtil.AddTableNameToCmd(CurrentUser.Id, server, baseCmdString, paramList, _start, _end, out addTableCmdString, out paramList);
            if (addTableCmdString.Length == 0)
            {
                //
                return;
            }

            string     cmdString = "SELECT LogKey1,LogKey3,LogData,LogTime FROM ({0}) AS A ORDER BY LogTime";
            SqlCommand cmd       = new SqlCommand(string.Format(cmdString, addTableCmdString), paramList.ToArray());
            SqlResult  result    = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                result.SetFieldType(new SqlDataType[] {
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.Blob,
                    SqlDataType.DateTime
                });

                object[]  record       = null;
                ArrayList infos        = new ArrayList();
                ArrayList roleGuidList = new ArrayList();

                while ((record = result.ReadRecord()) != null)
                {
                    ExchangeRecord info = new ExchangeRecord();

                    info.giverGuid = record[0] as string;
                    if (info.giverGuid != null && !roleGuidList.Contains(info.giverGuid))
                    {
                        roleGuidList.Add(info.giverGuid);
                    }
                    info.receiverGuid = record[1] as string;
                    if (info.receiverGuid != null && !roleGuidList.Contains(info.receiverGuid))
                    {
                        roleGuidList.Add(info.receiverGuid);
                    }
                    info.time = (DateTime)record[3];

                    string blobData = Encoding.Default.GetString((byte[])record[2]);
                    blobData = blobData.Replace("“", "\"");
                    blobData = blobData.Replace("”", "\"");
                    string[] blobDataSplit = blobData.Split('\"');
                    info.itemName = blobDataSplit[3];

                    infos.Add(info);
                }

                if (infos.Count == 0)
                {
                    //没有查询到信息
                    LabelOpMsg.Text     = StringDef.NoMatchingRecord;
                    PanelResult.Visible = false;
                }
                else
                {
                    PanelResult.Visible       = true;
                    DataGridResult.DataSource = CreateDataSource(infos, GetRoleGuid(roleGuidList));
                    DataGridResult.DataBind();
                }
            }
            else
            {
                if (result == null)
                {
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                }
                else
                {
                    LabelOpMsg.Text = StringDef.OperationFail;
                }
                PanelResult.Visible = false;
            }
        }
        catch (Exception ex)
        {
            PanelResult.Visible = false;
            LabelOpMsg.Text     = ex.Message;
        }
    }
    void Query(int offset)
    {
        try
        {
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ViewState[WebConfig.ParamServerId] = server.Id;

            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();
            string        cmdText         = "SELECT NodeName,LeaderName,LayerId,NodeGUID,ChildCount,ParentGUID FROM socialrelation {0} {1}";

            searchCondition.AppendFormat("WHERE {0}='1' ", FS2TableString.SocialrelationFieldTemplateId);
            if (DropDownListType.SelectedIndex != 0)
            {
                searchCondition.AppendFormat(" AND {0}='{1}'", FS2TableString.SocialrelationFieldLayerId, DropDownListType.SelectedValue);
            }

            string name = TextBoxName.Text.Trim();
            if (name.Length > 0)
            {
                if (CheckBoxName.Checked)
                {
                    searchCondition.AppendFormat(" AND {0}='?'", FS2TableString.SocialrelationFieldNodeName);
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} LIKE '%?%'", FS2TableString.SocialrelationFieldNodeName);
                }
                paramList.Add(name);
            }

            string leader = TextBoxLeaderName.Text.Trim();
            if (leader.Length > 0)
            {
                if (CheckBoxLeaderName.Checked)
                {
                    searchCondition.AppendFormat(" AND {0}='?'", FS2TableString.SocialrelationFieldLeaderName);
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} LIKE '%?%'", FS2TableString.SocialrelationFieldLeaderName);
                }
                paramList.Add(leader);
            }

            int    limitCount     = _recordPerPage;
            string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount);

            SqlCommand cmd    = new SqlCommand(string.Format(cmdText, searchCondition.ToString(), limitStatement), paramList.ToArray());
            SqlResult  result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                DataGridResult.DataSource = CreateDataSource(result);
                int rowCount = (DataGridResult.DataSource as DataView).Table.Rows.Count;
                if (rowCount == 0)
                {
                    LabelOpMsg.Text     = StringDef.NoMatchingRecord;
                    PanelResult.Visible = false;
                    return;
                }
                else
                {
                    ViewState[WebConfig.SessionQueryLogOffset] = offset;

                    ButtonPreviousPage.Enabled = (offset > 0);
                    ButtonFirstPage.Enabled    = (offset > 0);
                    ButtonNextPage.Enabled     = (rowCount >= limitCount);

                    PanelResult.Visible = true;
                    DataGridResult.DataBind();
                }
            }
            else
            {
                LabelOpMsg.Text        = StringDef.Query + StringDef.Failure;
                DataGridResult.Visible = false;
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text        = ex.Message;
            DataGridResult.Visible = false;
        }
    }
Esempio n. 29
0
    void Query(int offset)
    {
        ArrayList     paramList      = new ArrayList();
        StringBuilder whereStatement = new StringBuilder();

        whereStatement.Append("WHERE ");

        string ope = TextBoxOperator.Text.Trim();

        if (ope.Length != 0)
        {
            switch (RadioButtonListOperator.SelectedIndex)
            {
            case 0:
                whereStatement.AppendFormat("{0}='{1}' AND ", TableString.GMOpLogFieldUserId, ope);
                break;

            case 1:
                User user = TheAdminServer.SecurityManager.GetUser(ope);
                if (user != null)
                {
                    whereStatement.AppendFormat("{0}='{1}' AND ", TableString.GMOpLogFieldUserId, user.SecurityObject.Id);
                }
                else
                {
                    whereStatement.AppendFormat("{0}='{1}' AND ", TableString.GMOpLogFieldUserId, ope);
                }
                break;
            }
        }

        switch (RadioButtonListTarget.SelectedIndex)
        {
        case 1:
            whereStatement.AppendFormat("{0}={1} AND ", TableString.GMOpLogFieldTargetType, (int)GMUtil.GMOpTargetType.Account);
            break;

        case 2:
            whereStatement.AppendFormat("{0}={1} AND ", TableString.GMOpLogFieldTargetType, (int)GMUtil.GMOpTargetType.Role);
            break;

        default:
            break;
        }

        string target = TextBoxTarget.Text.Trim();

        if (target.Length != 0)
        {
            MySqlParameter param = new MySqlParameter("?target", MySqlDbType.Blob);
            if (CheckBoxExactlyMatch.Checked)
            {
                whereStatement.AppendFormat("{0}=?target AND ", TableString.GMOpLogFieldTarget);
                param.Value = Encoding.Default.GetBytes("target");
            }
            else
            {
                whereStatement.AppendFormat("{0} LIKE ?target AND ", TableString.GMOpLogFieldTarget);
                param.Value = Encoding.Default.GetBytes("%" + target + "%");
            }

            paramList.Add(param);
        }

        if (ServerDropDownList.Enabled)
        {
            whereStatement.AppendFormat("{0}={1} AND ", TableString.GMOpLogFieldServerId, ServerDropDownList.SelectedServerId);
        }

        if (CheckBoxListOperation.SelectedIndex != -1)
        {
            StringBuilder operationStr = new StringBuilder();
            foreach (ListItem item in CheckBoxListOperation.Items)
            {
                if (item.Selected)
                {
                    operationStr.AppendFormat("{0}={1} OR ", TableString.GMOpLogFieldOperation, int.Parse(item.Value));
                }
            }
            operationStr.Remove(operationStr.Length - 3, 3);
            whereStatement.Append(string.Format("({0}) AND ", operationStr.ToString()));
        }

        if (StartDate.Selected)
        {
            whereStatement.Append(string.Format("{0}>='{1}' AND ", TableString.GMOpLogFieldLogTime, StartDate.SelectedDate.ToString("yyyy-MM-dd HH:mm:ss")));
        }
        if (EndDate.Selected)
        {
            whereStatement.Append(string.Format("{0}<'{1}' AND ", TableString.GMOpLogFieldLogTime, EndDate.SelectedDate.ToString("yyyy-MM-dd HH:mm:ss")));
        }

        if (whereStatement.Length != 6)
        {
            whereStatement.Remove(whereStatement.Length - 4, 4);
        }
        else
        {
            whereStatement.Remove(0, whereStatement.Length);
        }

        int    limitCount     = _recordPerPage;
        string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount);

        string sqlStatement = string.Format("SELECT * FROM {0} {1} {2}", TableString.GMOpLogTableName, whereStatement.Length == 0 ? string.Empty : whereStatement.ToString(), limitStatement);

        //为动画效果而做延迟
        System.Threading.Thread.Sleep(500);

        DataTable table = LogSystem.TheInstance.QueryGMOperationLog(sqlStatement, paramList.ToArray());

        if (table != null && table.Rows.Count != 0)
        {
            PanelResult.Visible = true;

            DataGridResult.DataSource = CreateDataSource(table);
            DataGridResult.DataBind();

            ViewState[WebConfig.SessionQueryLogOffset] = offset;

            ButtonPreviousPage.Enabled = (offset > 0);
            ButtonFirstPage.Enabled    = (offset > 0);
            ButtonNextPage.Enabled     = (table.Rows.Count >= limitCount);
        }
        else
        {
            LabelOpMsg.Text    = StringDef.NoMatchingRecord;
            LabelOpMsg.Visible = true;
            return;
        }
    }
Esempio n. 30
0
    void Query(int offset)
    {
        try
        {
            PanelResult.Visible = false;

            GameServer server = AdminServer.TheInstance.GameServerManager.GetGameServer(int.Parse(serverGroupDropDownList.SelectedValue));
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            //读权限
            if (!WebUtil.CheckPrivilege(server.SecurityObject, OpType.READ, Session))
            {
                LabelOpMsg.Text = StringDef.NotEnoughPrivilege;
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();

            string cRoleName    = TextBoxcRoleName.Text;
            string cAccountName = TextBoxcAccountName.Text;
            WebUtil.ValidateValueString(cRoleName);
            WebUtil.ValidateValueString(cAccountName);
            //角色名
            if (cRoleName.Length > 0)
            {
                if (CheckBoxcRoleName.Checked)
                {
                    searchCondition.AppendFormat(" AND {0}='?'", JX2TableString.cRoleName);
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} LIKE '%?%'", JX2TableString.cRoleName);
                }
                paramList.Add(cRoleName);
            }
            //帐号名
            if (cAccountName.Length > 0)
            {
                if (CheckBoxcAccountName.Checked)
                {
                    searchCondition.Append(string.Format(" AND {0}='?'", JX2TableString.cAccountName));
                }
                else
                {
                    searchCondition.Append(string.Format(" AND {0} LIKE '%?%'", JX2TableString.cAccountName));
                }
                paramList.Add(cAccountName);
            }


            //性别
            int sex = ListBoxSex.SelectedIndex - 1;
            if (sex >= 0)
            {
                searchCondition.Append(string.Format(" AND {0}={1}", JX2TableString.iSex, sex));
            }
            //总在线时间
            string gametime_start_str = TextBoxdwGameTime_start.Text;
            string gametime_end_str   = TextBoxdwGameTime_end.Text;
            if (gametime_start_str != "" && gametime_end_str != "")
            {
                int GameTime_start = Convert.ToInt32(TextBoxdwGameTime_start.Text);
                int GameTime_end   = Convert.ToInt32(TextBoxdwGameTime_end.Text);

                if (GameTime_start > GameTime_end)
                {
                    LabelOpMsg.Text = StringDef.EndTimesmallerThanStartTime;
                    return;
                }
                else
                {
                    GameTime_start = GameTime_start * 3600;
                    GameTime_end   = GameTime_end * 3600;
                    searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<='{2}'", JX2TableString.iGameTime,
                                                 GameTime_start, GameTime_end);
                }
            }



            //金钱
            string Money_start_str = TextBoxMoney_start.Text;
            string Money_end_str   = TextBoxMoney_end.Text;
            if (Money_start_str != "" && Money_end_str != "")
            {
                int Money_start = Convert.ToInt32(TextBoxMoney_start.Text);
                int Money_end   = Convert.ToInt32(TextBoxMoney_end.Text);
                if (Money_start > Money_end)
                {
                    LabelOpMsg.Text = StringDef.EndTimesmallerThanStartTime;
                    return;
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<='{2}'", JX2TableString.iMoney,
                                                 Money_start, Money_end);
                }
            }



            //创建时间
            DateTime createtime_start = CreateTime_start.SelectedDate;
            DateTime createtime_end   = CreateTime_end.SelectedDate;
            if (createtime_start != DateTime.MinValue && createtime_end == DateTime.MinValue)
            {
                searchCondition.AppendFormat(" AND {0}>='{1}'", JX2TableString.dCreateTime,
                                             createtime_start.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else if (createtime_start == DateTime.MinValue && createtime_end != DateTime.MinValue)
            {
                searchCondition.AppendFormat(" AND {0}<='{1}'", JX2TableString.dCreateTime,
                                             createtime_end.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else if (createtime_start != DateTime.MinValue && createtime_end != DateTime.MinValue)
            {
                if (createtime_start > createtime_end)
                {
                    LabelOpMsg.Text = StringDef.ParameterInputError;
                    return;
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<='{2}'", JX2TableString.dCreateTime,
                                                 createtime_start.ToString("yyyy-MM-dd HH:mm:ss"), createtime_end.ToString("yyyy-MM-dd HH:mm:ss"));
                }
            }


            //最后一次登陆时间
            DateTime lastlogintime_start = LastLoginTime_start.SelectedDate;
            DateTime lastlogintime_end   = LastLoginTime_end.SelectedDate;
            if (lastlogintime_start != DateTime.MinValue && lastlogintime_end == DateTime.MinValue)
            {
                searchCondition.AppendFormat(" AND {0}>='{1}'", JX2TableString.dLastLoginTime,
                                             lastlogintime_start.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else if (lastlogintime_start == DateTime.MinValue && lastlogintime_end != DateTime.MinValue)
            {
                searchCondition.AppendFormat(" AND {0}<='{1}'", JX2TableString.dLastLoginTime,
                                             lastlogintime_end.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (lastlogintime_start != DateTime.MinValue && lastlogintime_end != DateTime.MinValue)
            {
                if (lastlogintime_start > lastlogintime_end)
                {
                    LabelOpMsg.Text = StringDef.EndTimesmallerThanStartTime;
                    return;
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<='{2}'", JX2TableString.dLastLoginTime,
                                                 lastlogintime_start.ToString("yyyy-MM-dd HH:mm:ss"), lastlogintime_end.ToString("yyyy-MM-dd HH:mm:ss"));
                }
            }

            //角色
            StringBuilder roleTypeBuilder = new StringBuilder();
            foreach (ListItem item in CheckBoxListRoleType.Items)
            {
                if (item.Selected)
                {
                    string[] conValue = item.Value.Split(',');
                    roleTypeBuilder.AppendFormat("({0}='{1}' AND {2}='{3}') OR ", JX2TableString.iFaction, conValue[0], JX2TableString.iFactionRoute, conValue[1]);    //门派,与门派路线
                }
            }
            if (roleTypeBuilder.Length != 0)
            {
                searchCondition.AppendFormat(" AND ({0}) ", roleTypeBuilder.ToString(0, roleTypeBuilder.Length - 3));
            }
            else
            {
                LabelOpMsg.Text    = string.Format(StringDef.MsgCannotBeNone, StringDef.RoleClass);
                LabelOpMsg.Visible = true;
                return;
            }

            //等级排序
            int startLevel = int.Parse(ListBoxStartLevel.SelectedValue);
            if (startLevel > 1)
            {
                searchCondition.Append(string.Format(" AND {0}>={1}", JX2TableString.iLevel, startLevel));
            }

            int endLevel = int.Parse(ListBoxEndLevel.SelectedValue);
            if (endLevel < FS2GameDataManager.MaxLevel)
            {
                searchCondition.Append(string.Format(" AND {0}<={1}", JX2TableString.iLevel, endLevel));
            }

            if (searchCondition.Length > 0)
            {
                searchCondition.Remove(0, 4);
                searchCondition.Insert(0, " WHERE");
            }

            //排序
            string orderByType = string.Empty;
            switch (ListBoxOrderByType.SelectedIndex)
            {
            case 0:
                orderByType = "ASC";
                break;

            case 1:
                orderByType = "DESC";
                break;
            }

            string orderByStatement = string.Empty;
            switch (ListBoxOrderBy.SelectedIndex)
            {
            case 0:
                orderByStatement = string.Format(" ORDER BY {0} {1}", JX2TableString.iLevel, orderByType);
                break;

            case 1:
                orderByStatement = string.Format(" ORDER BY {0} {1}", JX2TableString.iFaction, orderByType);
                break;
            }

            int    limitCount     = _recordPerPage;
            string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount + 1);

            SqlCommand cmd = new SqlCommand("SELECT cAccountName,cRoleName,iSex,iLevel,iGameTime,iFaction,iFactionRoute,iMoney, dCreateTime,dLastLoginTime,cRoleID FROM trolebaseinfo" + searchCondition.ToString() + orderByStatement + limitStatement, paramList.ToArray());

            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);

            if (result != null && result.Success)
            {
                ViewState[WebConfig.SessionQueryLogOffset] = offset;

                result.SetFieldType(
                    new SqlDataType[] {
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.SByte,
                    SqlDataType.Int32,    //等级
                    SqlDataType.Int32,    //在线时间
                    SqlDataType.Int32,
                    SqlDataType.Int32,
                    SqlDataType.Int64,
                    SqlDataType.DateTime,
                    SqlDataType.DateTime,
                    SqlDataType.String
                });
                //做结果列表了
                ArrayList roles  = new ArrayList();
                object[]  record = null;
                //Encoding utf8 = Encoding.UTF8;
                //Encoding gb2312 = Encoding.GetEncoding("GB2312");
                while ((record = result.ReadRecord()) != null)
                {
                    JX2RoleDataInfo info = new JX2RoleDataInfo();
                    info.cAccountName = (string)record[0];
                    //string strRoleName = (string)record[1];
                    //info.cRoleName = utf8.GetString(gb2312.GetBytes(strRoleName));
                    info.cRoleName = (string)record[1];
                    info.iSex      = (JX2RoleSex)(SByte)record[2];
                    info.iLevel    = (int)record[3];
                    //在线时间
                    info.iGameTime = (int)record[4];
                    //这个是门派字段
                    info.iFaction = (int)record[5];
                    //这个是门派路线字段
                    info.iFactionRoute = (int)record[6];
                    //这个是职业字段
                    info.RoleType = (JxRoleType)(info.iFaction * 100 + info.iFactionRoute);//RoleType等于iFaction乘100与iFactionRoute相加,为了与JxRoleType批配
                    info.iMoney   = (Int64)record[7];
                    if (record[8] != null)
                    {
                        info.dCreateTime = (DateTime)record[8];
                    }
                    //游戏新建角色,没登陆显示的上次登陆时间为1970-1-1 10:00:00,处理:上次登陆时间小与创建时间的,上次登陆时间置为创建时间
                    if (record[9] != null && (DateTime)record[9] > (DateTime)record[8])
                    {
                        info.dLastLoginTime = (DateTime)record[9];
                    }
                    else
                    {
                        info.dLastLoginTime = (DateTime)record[8];
                    }
                    info.cRoleID = (String)record[10];
                    roles.Add(info);
                }


                ButtonPreviousPage.Enabled = (offset > 0);
                ButtonFirstPage.Enabled    = (offset > 0);
                ButtonNextPage.Enabled     = (roles.Count > limitCount);
                DataGridResult.DataSource  = CreateDataSource(roles);
                DataGridResult.DataBind();

                if (roles != null && roles.Count != 0)
                {
                    PanelResult.Visible = true;
                }
                else
                {
                    PanelResult.Visible = false;
                }

                if (!PanelResult.Visible)
                {
                    LabelOpMsg.Text = StringDef.NoMatchingRecord;
                }
            }
            else
            {
                if (result == null)
                {
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                }
                else
                {
                    LabelOpMsg.Text = StringDef.OperationFail;
                }
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text     = ex.Message;
            PanelResult.Visible = false;
        }
    }