コード例 #1
0
        public void GetData()
        {
            this.ShowWaitingPanel(() =>
            {
                try
                {
                    _dsQueryXml = TmoShare.getDataSetFromXML(SubmitXml, true);
                    if (_dsQueryXml.Tables[0].Rows.Count == 0)
                    {
                        _dsQueryXml.Tables[0].Rows.Add(_dsQueryXml.Tables[0].NewRow());
                    }
                    _dsQueryXml.Tables[0].Rows[0]["doc_code"]  = TmoComm.login_docInfo.children_docid;
                    _dsQueryXml.Tables[0].Rows[0]["page_size"] = _pageSize.ToString();
                    _dsQueryXml.Tables[0].Rows[0]["now_page"]  = _currentPage.ToString();
                    if (!string.IsNullOrEmpty(this.userID.Text))
                    {
                        _dsQueryXml.Tables[0].Rows[0]["user_id"] = this.userID.Text;
                    }
                    if (!string.IsNullOrEmpty(this.txtName.Text))
                    {
                        _dsQueryXml.Tables[0].Rows[0]["name"] = this.txtName.Text;
                    }
                    if (Time.Checked)
                    {
                        _dsQueryXml.Tables[0].Rows[0]["date_start"] = datestart.EditValue.ToString();
                        _dsQueryXml.Tables[0].Rows[0]["date_end"]   = dateend.EditValue.ToString();
                    }
                    string selexml = TmoShare.getXMLFromDataSet(_dsQueryXml);

                    string strmlx    = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetLivingList, new object[] { selexml });
                    _dsGetDataResult = TmoShare.getDataSetFromXML(strmlx);
                    if (TmoShare.DataSetIsNotEmpty(_dsGetDataResult))
                    {
                        DataTable dtCount = _dsGetDataResult.Tables["Count"];
                        count             = dtCount.Rows[0]["totalRowCount"].ToString();
                        double countnum   = double.Parse(count) / _pageSize;
                        pageCount         = Math.Ceiling(countnum).ToString();
                        return(_dsGetDataResult.Tables[1]);
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch
                { }
                return(null);
            }, x =>
            {
                try
                {
                    DataTable dt       = x as DataTable;
                    dgcTree.DataSource = dt;
                    if (gridView1.GroupCount > 0)
                    {
                        gridView1.ExpandAllGroups();
                    }
                    gridView1.MoveFirst();
                    if (dt == null)
                    {
                        return;
                    }

                    lblCount.Text     = string.Format("共[{0}]条", count);
                    lblPageIndex.Text = string.Format("第[{0}]页,共[{1}]页", _currentPage.ToString(), _pageSize.ToString());
                    txtPageIndex.Text = _currentPage.ToString();
                    txtPageSize.Text  = _pageSize.ToString();

                    llblUp.Enabled   = _currentPage > 1;
                    llblDown.Enabled = _currentPage < int.Parse(pageCount);
                }
                catch (Exception ex)
                {
                    LogHelper.Log.Error("实体加载数据出错", ex);
                    DXMessageBox.ShowWarning2("数据加载失败!请重试!");
                }
            });
        }
コード例 #2
0
ファイル: frmdddd.cs プロジェクト: Arainsd/HealthManagement
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string contype = "";

            if (cmproType.SelectedIndex == 0)
            {
                DXMessageBox.Show("请选择题目答案的类型");
            }
            else
            {
                switch (cmproType.SelectedIndex)
                {
                case 1:
                    contype = "1";
                    break;

                case 2:
                    contype = "4";
                    break;

                case 3:
                    contype = "5";
                    break;

                case 4:
                    contype = "6";
                    break;
                }
            }
            if (string.IsNullOrEmpty(dic_name.Text))
            {
                DXMessageBox.Show("指标名称不能为空");
                return;
            }
            bool dicNametur = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.checkname, new object[] { dic_name.Text });

            if (!dicNametur)
            {
                DXMessageBox.Show("该指标名称已经被使用"); return;
            }
            if (string.IsNullOrEmpty(control_static.Text) && control_static.Visible)
            {
                DXMessageBox.Show("答案不能为空"); return;
            }

            DataTable dt = new DataTable();

            dt.TableName = "dd";
            dt.Columns.Add("dic_id", typeof(string));
            dt.Columns.Add("dic_name", typeof(string));
            dt.Columns.Add("dic_unit", typeof(string));
            dt.Columns.Add("control_type", typeof(string));
            dt.Columns.Add("contorl_static", typeof(string));
            DataRow drd = dt.NewRow();

            drd["dic_name"]       = dic_name.Text;
            drd["dic_unit"]       = dic_unit.Text;
            drd["control_type"]   = contype;
            drd["contorl_static"] = control_static.Text;

            if (update)
            {
                drd["dic_id"] = drinput["dic_id"];
                dt.Rows.Add(drd);
                string xml       = TmoShare.getXMLFromDataTable(dt);
                bool   updteTrue = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.updatemedic, new object[] { xml });
                if (updteTrue)
                {
                    DXMessageBox.ShowSuccess("修改成功");
                }
                else
                {
                    DXMessageBox.ShowWarning2("修改失败");
                }
            }
            else
            {
                dt.Rows.Add(drd);
                string xml       = TmoShare.getXMLFromDataTable(dt);
                bool   updteTrue = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.medicadd, new object[] { xml });
                if (updteTrue)
                {
                    DXMessageBox.ShowSuccess("添加成功");
                }
                else
                {
                    DXMessageBox.ShowWarning2("添加失败");
                }
            }
        }