コード例 #1
0
        public static IList <T> GetEntities <T>(PopulateDelegate <T> pd, string sql, string _conStr,
                                                params SqlParameter[] parameters)
        {
            IList <T>     lst    = new List <T>();
            SqlDataReader reader = null;

            try
            {
                reader = GetDataReader(sql, parameters, _conStr);
                Dictionary <string, string> Fileds = new Dictionary <string, string>();
                foreach (DataRow var in reader.GetSchemaTable().Select())
                {
                    Fileds.Add(var[0].ToString(), var[0].ToString());
                }
                while (reader.Read())
                {
                    lst.Add(pd(reader, Fileds, _conStr));
                }
            }
            catch (Exception ex)
            {
                QuartzInAction.Common.Loger.WriteFile(
                    "public static IList<T> GetEntities<T>(PopulateDelegate<T> pd, string sql, string _conStr, params SqlParameter[] parameters)出错!" +
                    ex);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(lst);
        }
コード例 #2
0
        /// <summary>
        /// Populates the DataGridView control with data.
        /// </summary>
        public void Populate()
        {
            if (dgvLog.InvokeRequired)
            {
                var d = new PopulateDelegate(Populate);
                Invoke(d, new object[] { });
            }
            else
            {
                try
                {
                    if (((string)ddLogType.SelectedValue) == "0")
                    {
                        dgvLog.DataSource = LogsRepo.LoadAll().Result;
                    }
                    else
                    {
                        dgvLog.DataSource = LogsRepo.LoadSpecific(((string)ddLogType.SelectedValue)).Result;
                    }

                    dgvLog.Columns["Machine"].Visible = false;
                    dgvLog.Columns["LogTypeId"].Width = 65;
                    dgvLog.Columns["Version"].Width   = 55;
                    dgvLog.Columns["Event"].Width     = 100;
                    dgvLog.Columns["Id"].Width        = 55;
                }
                catch (Exception e)
                {
                    Logger.Log(e, "Unable to fetch logs from the database and bind gridview", Log.LogTypeEnum.Critical);
                }

                SetTitle("Application Log");
                SetLogsClearedMessage($"Logs are cleared after {Global.ClearLogsAfterDays} days.");
            }
        }
コード例 #3
0
        public void Populates_Value(PopulateDelegate @delegate)
        {
            var binder = new JsonBinder();

            var result = (PopulatesFixture)@delegate(
                binder,
                new PopulatesFixture()
            {
                A = "123",
                B = 789,
            },
                JsonBinder.DefaultSerializer,
                new[]
            {
                new KeyValuePair <string, string>("B", "123"),
                new KeyValuePair <string, string>("ComplexProperty:value", "123"),
                new KeyValuePair <string, string>("ComplexProperty:AutoProperty:value", "456"),
                new KeyValuePair <string, string>("something", "1123"),
                new KeyValuePair <string, string>("somethingelse:value", "1456"),
                new KeyValuePair <string, string>("ComplexProperty:something", "2123"),
                new KeyValuePair <string, string>("ComplexProperty:somethingelse:value", "2456"),
            });

            result.A.Should().Be("123");
            result.B.Should().Be(123);

            result.ComplexProperty.Value.Should().Be("123");
            result.ComplexProperty.CustomFields.Should().NotBeEmpty();
            result.CustomFields.Should().NotBeEmpty();

            Logger.LogInformation(JsonConvert.SerializeObject(result.CustomFields));
        }
コード例 #4
0
 public DocumentsListView()
 {
     InitializeComponent();
     View          = View.Details;
     mIsPopulating = false;
     //mPopulateThread = new Thread(new ThreadStart(SafelyPopulate));
     mDocumentAddDelegate = new DocumentAddDelegate(SafelyAddDocument);
     mPopulateDelegate    = new PopulateDelegate(SafelyPopulate2);
 }
コード例 #5
0
        /// <summary>
        /// Populates the DataGridView control with data.
        /// </summary>
        public void Populate()
        {
            if (dvgLog.InvokeRequired)
            {
                var d = new PopulateDelegate(Populate);
                Invoke(d, new object[] { });
            }
            else
            {
                try
                {
                    if (!_shown)
                    {
                        Logger.LogInfo("Populate - Issues", "Loading issues from the database");
                        dvgLog.DataSource = MainForm.MusicFileRepo.LoadIssues().Result;

                        dvgLog.Columns["Hash"].Visible        = false;
                        dvgLog.Columns["Removed"].Visible     = false;
                        dvgLog.Columns["MbId"].Visible        = false;
                        dvgLog.Columns["VideoId"].Visible     = false;
                        dvgLog.Columns["ReleaseMbId"].Visible = false;
                        dvgLog.Columns["EntityId"].Visible    = false;
                        dvgLog.Columns["LastUpload"].Visible  = false;
                        dvgLog.Columns["Error"].Visible       = false;
                        dvgLog.Columns["Id"].Width            = 55;
                        dvgLog.Columns["Path"].FillWeight     = 300;
                        dvgLog.Columns["LastUpload"].Width    = 100;

                        var buttonColumn = new DataGridViewImageColumn
                        {
                            Name  = "Reset",
                            Image = Properties.Resources.reset
                        };

                        dvgLog.Columns.Add(buttonColumn);
                        dvgLog.Columns["Reset"].Width = 50;

                        _shown = true;
                    }
                    else
                    {
                        dvgLog.DataSource = MainForm.MusicFileRepo.LoadIssues().Result;
                    }

                    SetResetEnabled(((List <MusicFile>)dvgLog.DataSource).Count > 0);
                }
                catch (Exception e)
                {
                    Logger.Log(e, "Unable to fetch issues from the database and bind gridview", Log.LogTypeEnum.Critical);
                }

                SetTitle("Issues Log");
            }
        }
コード例 #6
0
        /// <summary>
        /// 返回IList
        /// </summary>
        /// <param name="pd">委托对象</param>
        /// <param name="queryParam">查询字符串</param>
        /// <param name="count">返回记录总数</param>
        /// <returns>返回记录集List</returns>
        public static IList <T> GetEntities <T>(PopulateDelegate <T> pd, QuartzInAction.Common.QueryParam queryParam,
                                                string _conStr, out int count)
        {
            List <T> lst = new List <T>();

            count = 0;
            using (SqlConnection conn = new SqlConnection(_conStr))
            {
                SqlCommand cmd = new SqlCommand("SupesoftPage", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                // 设置参数
                cmd.Parameters.Add("@TableName", SqlDbType.NVarChar, 500).Value    = queryParam.TableName;
                cmd.Parameters.Add("@ReturnFields", SqlDbType.NVarChar, 500).Value = queryParam.ReturnFields;
                cmd.Parameters.Add("@Where", SqlDbType.NVarChar, 500).Value        = queryParam.Where;
                cmd.Parameters.Add("@PageIndex", SqlDbType.Int).Value          = queryParam.PageIndex;
                cmd.Parameters.Add("@PageSize", SqlDbType.Int).Value           = queryParam.PageSize;
                cmd.Parameters.Add("@Orderfld", SqlDbType.NVarChar, 200).Value = queryParam.Orderfld;
                cmd.Parameters.Add("@OrderType", SqlDbType.Int).Value          = queryParam.OrderType;
                // 执行
                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                Dictionary <string, string> Fileds = new Dictionary <string, string>();
                foreach (DataRow var in dr.GetSchemaTable().Select())
                {
                    Fileds.Add(var[0].ToString(), var[0].ToString());
                }
                while (dr.Read())
                {
                    lst.Add(pd(dr, Fileds, _conStr));
                }
                // 取记录总数 及页数
                if (dr.NextResult())
                {
                    if (dr.Read())
                    {
                        count = Convert.ToInt32(dr["RecordCount"]);
                    }
                }

                dr.Close();
                cmd.Dispose();
                conn.Close();
            }
            return(lst);
        }
コード例 #7
0
ファイル: SqlDataProvider.cs プロジェクト: liu4434004/EHR2
        /// <summary>
        /// 公共查询数据函数Sql存储过程版
        /// </summary>
        /// <param name="pd">委托对象</param>
        /// <param name="pp">查询字符串</param>
        /// <param name="RecordCount">返回记录总数</param>
        /// <returns>返回记录集ArrayList</returns>
        private ArrayList GetObjectList(PopulateDelegate pd, QueryParam pp, out int RecordCount)
        {
            ArrayList lst = new ArrayList();

            RecordCount = 0;
            using (SqlConnection conn = GetSqlConnection())
            {
                SqlCommand cmd = new SqlCommand("SupesoftPage", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                // 设置参数
                cmd.Parameters.Add("@TableName", SqlDbType.NVarChar, 500).Value    = pp.TableName;
                cmd.Parameters.Add("@ReturnFields", SqlDbType.NVarChar, 500).Value = pp.ReturnFields;
                cmd.Parameters.Add("@Where", SqlDbType.NVarChar, 500).Value        = pp.Where;
                cmd.Parameters.Add("@PageIndex", SqlDbType.Int).Value          = pp.PageIndex;
                cmd.Parameters.Add("@PageSize", SqlDbType.Int).Value           = pp.PageSize;
                cmd.Parameters.Add("@Orderfld", SqlDbType.NVarChar, 200).Value = pp.Orderfld;
                cmd.Parameters.Add("@OrderType", SqlDbType.Int).Value          = pp.OrderType;
                // 执行
                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    lst.Add(pd(dr));
                }
                // 取记录总数 及页数
                if (dr.NextResult())
                {
                    if (dr.Read())
                    {
                        RecordCount = Convert.ToInt32(dr["RecordCount"]);
                    }
                }

                dr.Close();
                cmd.Dispose();
                conn.Close();
            }
            return(lst);
        }
コード例 #8
0
ファイル: UploadLog.cs プロジェクト: DaveCS1/YTMusicUploader
 /// <summary>
 /// Populates the DataGridView control with data.
 /// </summary>
 public void Populate()
 {
     if (dgvUploads.InvokeRequired)
     {
         PopulateDelegate d = new PopulateDelegate(Populate);
         Invoke(d, new object[] { });
     }
     else
     {
         dgvUploads.DataSource = MainForm.MusicFileRepo.LoadUploaded().Result;
         dgvUploads.Columns["ReleaseMbId"].Visible   = false;
         dgvUploads.Columns["EntityId"].Visible      = false;
         dgvUploads.Columns["Hash"].Visible          = false;
         dgvUploads.Columns["Removed"].Visible       = false;
         dgvUploads.Columns["Error"].Visible         = false;
         dgvUploads.Columns["ErrorReason"].Visible   = false;
         dgvUploads.Columns["Id"].Width              = 55;
         dgvUploads.Columns["Path"].FillWeight       = 300;
         dgvUploads.Columns["LastUpload"].Width      = 100;
         dgvUploads.Columns["MbId"].DefaultCellStyle = GetHyperLinkStyleForGridCell();
         SetTitle("Upload Log");
     }
 }
コード例 #9
0
ファイル: IssueLog.cs プロジェクト: DaveCS1/YTMusicUploader
        /// <summary>
        /// Populates the DataGridView control with data.
        /// </summary>
        public void Populate()
        {
            if (dgvIssues.InvokeRequired)
            {
                PopulateDelegate d = new PopulateDelegate(Populate);
                Invoke(d, new object[] { });
            }
            else
            {
                dgvIssues.DataSource = MainForm.MusicFileRepo.LoadIssues().Result;
                dgvIssues.Columns["Hash"].Visible        = false;
                dgvIssues.Columns["Removed"].Visible     = false;
                dgvIssues.Columns["MbId"].Visible        = false;
                dgvIssues.Columns["ReleaseMbId"].Visible = false;
                dgvIssues.Columns["EntityId"].Visible    = false;
                dgvIssues.Columns["Id"].Width            = 55;
                dgvIssues.Columns["Error"].Width         = 45;
                dgvIssues.Columns["Path"].FillWeight     = 300;
                dgvIssues.Columns["LastUpload"].Width    = 100;

                SetTitle("Issues Log");
            }
        }
コード例 #10
0
        /// <summary>
        /// Populates the DataGridView control with data.
        /// </summary>
        public void Populate()
        {
            if (dvgLog.InvokeRequired)
            {
                var d = new PopulateDelegate(Populate);
                Invoke(d, new object[] { });
            }
            else
            {
                try
                {
                    Logger.LogInfo("Populate - Uploads", "Loading issues from the database");

                    dvgLog.DataSource = MainForm.MusicFileRepo.LoadUploaded().Result;
                    dvgLog.Columns["ReleaseMbId"].Visible     = false;
                    dvgLog.Columns["EntityId"].Visible        = false;
                    dvgLog.Columns["VideoId"].Visible         = false;
                    dvgLog.Columns["Hash"].Visible            = false;
                    dvgLog.Columns["Removed"].Visible         = false;
                    dvgLog.Columns["Error"].Visible           = false;
                    dvgLog.Columns["ErrorReason"].Visible     = false;
                    dvgLog.Columns["UploadAttempts"].Visible  = false;
                    dvgLog.Columns["LastUploadError"].Visible = false;
                    dvgLog.Columns["Id"].Width              = 55;
                    dvgLog.Columns["Path"].FillWeight       = 300;
                    dvgLog.Columns["LastUpload"].Width      = 100;
                    dvgLog.Columns["MbId"].DefaultCellStyle = GetHyperLinkStyleForGridCell();
                }
                catch (Exception e)
                {
                    Logger.Log(e, "Unable to fetch uploads from the database and bind gridview", Log.LogTypeEnum.Critical);
                }

                SetTitle("Upload Log");
            }
        }
コード例 #11
0
ファイル: OracleDataProvider.cs プロジェクト: hezejiang/EHR
 /// <summary>
 /// ����sys_RolePermissionTableʵ�����ArrayList����
 /// </summary>
 /// <param name="qp">��ѯ��</param>
 /// <param name="RecordCount">���ؼ�¼����</param>
 /// <returns>sys_RolePermissionTableʵ�����ArrayList����</returns>
 public override ArrayList sys_RolePermissionList(QueryParam qp, out int RecordCount)
 {
     PopulateDelegate mypd = new PopulateDelegate(base.Populatesys_RolePermission);
     return this.GetObjectList(mypd, qp, out RecordCount);
 }
コード例 #12
0
        /// <summary>
        /// 公共查询数据函数Access版
        /// </summary>
        /// <param name="pd">委托对象</param>
        /// <param name="pp">查询字符串</param>
        /// <param name="RecordCount">返回记录总数</param>
        /// <returns>返回记录集ArrayList</returns>
        private ArrayList GetObjectList(PopulateDelegate pd, QueryParam pp, out int RecordCount)
        {
            ArrayList lst = new ArrayList();
            RecordCount = 0;
            using (OleDbConnection Conn = GetSqlConnection())
            {
                StringBuilder sb = new StringBuilder();
                OleDbCommand cmd = new OleDbCommand();
                OleDbDataReader dr = null;
                cmd.Connection = Conn;

                int TotalRecordForPageIndex = pp.PageIndex * pp.PageSize;
                string OrderBy;
                string CutOrderBy;
                if (pp.OrderType == 1)
                {
                    OrderBy = " Order by " + pp.Orderfld.Replace(",", " desc,") + " desc ";
                    CutOrderBy = " Order by " + pp.Orderfld.Replace(",", " asc,") + " asc ";
                }
                else
                {
                    OrderBy = " Order by " + pp.Orderfld.Replace(",", " asc,") + " asc ";
                    CutOrderBy = " Order by " + pp.Orderfld.Replace(",", " desc,") + " desc ";
                }

                Conn.Open();
                // 取记录总数
                cmd.CommandText = string.Format("SELECT Count(1) From {0} {1}", pp.TableName, pp.Where);
                RecordCount = Convert.ToInt32(cmd.ExecuteScalar());
                cmd.Parameters.Clear();

                int CurrentPageSize = pp.PageSize;
                if ((RecordCount - 1) / pp.PageSize + 1 == pp.PageIndex)
                {
                    CurrentPageSize = RecordCount % pp.PageSize;
                    if (CurrentPageSize == 0)
                        CurrentPageSize = pp.PageSize;
                }
                //取记录值
                sb.AppendFormat("SELECT * FROM (SELECT TOP {0} * FROM (SELECT TOP {1} {2}	FROM {3} {4} {5}) TB2	{6}) TB3 {5} ", CurrentPageSize, TotalRecordForPageIndex, pp.ReturnFields, pp.TableName, pp.Where, OrderBy, CutOrderBy);
                cmd.CommandText = sb.ToString();
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    lst.Add(pd(dr));
                }
                dr.Close();
                dr.Dispose();
                dr.Close();
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return lst;
        }
コード例 #13
0
ファイル: OracleDataProvider.cs プロジェクト: hezejiang/EHR
        /// <summary>
        /// ������ѯ���ݺ���Oracle��
        /// </summary>
        /// <param name="pd">ί�ж���</param>
        /// <param name="pp">��ѯ�ַ���</param>
        /// <param name="RecordCount">���ؼ�¼����</param>
        /// <returns>���ؼ�¼��ArrayList</returns>
        private ArrayList GetObjectList(PopulateDelegate pd, QueryParam pp, out int RecordCount)
        {
            ArrayList lst = new ArrayList();
            RecordCount = 0;
            using (OracleConnection Conn = GetSqlConnection())
            {
                StringBuilder sb = new StringBuilder();
                OracleCommand cmd = new OracleCommand();
                OracleDataReader dr = null;
                cmd.Connection = Conn;

                int TotalRecordForPageIndex = pp.PageIndex * pp.PageSize;
                int FirstRecordForPageIndex = (pp.PageIndex - 1) * pp.PageSize;
                string OrderBy;
                if (pp.OrderType == 1)
                {
                    OrderBy = " Order by " + pp.Orderfld.Replace(",", " desc,") + " desc ";
                }
                else
                {
                    OrderBy = " Order by " + pp.Orderfld.Replace(",", " asc,") + " asc ";
                }
                sb.AppendFormat("SELECT * FROM (SELECT A.*, ROWNUM RN FROM (SELECT * FROM {0} {1} {2}) A WHERE ROWNUM <= {3})WHERE RN > {4} ", pp.TableName.ToUpper(), pp.Where, OrderBy, TotalRecordForPageIndex, FirstRecordForPageIndex);
                cmd.CommandText = sb.ToString();
                Conn.Open();
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    lst.Add(pd(dr));
                }
                dr.Close();
                cmd.Parameters.Clear();
                // ȡ��¼����
                cmd.CommandText = string.Format("SELECT Count(1) From {0} {1}", pp.TableName, pp.Where);
                RecordCount = Convert.ToInt32(cmd.ExecuteScalar());
                dr.Dispose();
                dr.Close();
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return lst;
        }
コード例 #14
0
ファイル: OracleDataProvider.cs プロジェクト: hezejiang/EHR
 /// <summary>
 /// ����sys_FieldValueTableʵ�����ArrayList����
 /// </summary>
 /// <param name="qp">��ѯ��</param>
 /// <param name="RecordCount">���ؼ�¼����</param>
 /// <returns>sys_FieldValueTableʵ�����ArrayList����</returns>
 public override ArrayList sys_FieldValueList(QueryParam qp, out int RecordCount)
 {
     PopulateDelegate mypd = new PopulateDelegate(base.Populatesys_FieldValue);
     return this.GetObjectList(mypd, qp, out RecordCount);
 }
コード例 #15
0
ファイル: SqlDataProvider.cs プロジェクト: mind0n/hive
 /// <summary>
 /// 返回PM_ProjectsTable实体类的ArrayList对象
 /// </summary>
 /// <param name="qp">查询类</param>
 /// <param name="RecordCount">返回记录总数</param>
 /// <returns>PM_ProjectsTable实体类的ArrayList对象</returns>
 public override ArrayList PM_ProjectsList(QueryParam qp, out int RecordCount)
 {
     PopulateDelegate mypd = new PopulateDelegate(base.PopulatePM_ProjectsTable);
     return this.GetObjectList(mypd, qp, out RecordCount);
 }
コード例 #16
0
        /// <summary>
        /// 返回IList
        /// </summary>
        /// <param name="pd">委托对象</param>
        /// <param name="queryParam">查询字符串</param>
        /// <param name="i">重载标记字段,任意数值</param>
        /// <param name="count">返回记录总数</param>
        /// <returns>返回记录集List</returns>
        public static IList <T> GetEntities <T>(PopulateDelegate <T> pd, QuartzInAction.Common.QueryParam queryParam, int i,
                                                out int count, string _conStr)
        {
            IList <T> lst = new List <T>();

            count = 0;
            using (SqlConnection Conn = new SqlConnection(_conStr))
            {
                StringBuilder sb  = new StringBuilder();
                SqlCommand    cmd = new SqlCommand();
                SqlDataReader dr  = null;
                cmd.Connection = Conn;

                int    TotalRecordForPageIndex = queryParam.PageIndex * queryParam.PageSize;
                string OrderBy;
                string CutOrderBy;
                if (queryParam.OrderType == 1)
                {
                    OrderBy    = " Order by " + queryParam.Orderfld.Replace(",", " desc,") + " desc ";
                    CutOrderBy = " Order by " + queryParam.Orderfld.Replace(",", " asc,") + " asc ";
                }
                else
                {
                    OrderBy    = " Order by " + queryParam.Orderfld.Replace(",", " asc,") + " asc ";
                    CutOrderBy = " Order by " + queryParam.Orderfld.Replace(",", " desc,") + " desc ";
                }

                Conn.Open();
                // 取记录总数
                cmd.CommandText = string.Format("SELECT Count(1) From {0} {1}", queryParam.TableName, queryParam.Where);
                count           = Convert.ToInt32(cmd.ExecuteScalar());
                cmd.Parameters.Clear();

                int CurrentPageSize = queryParam.PageSize;
                if ((count - 1) / queryParam.PageSize + 1 == queryParam.PageIndex)
                {
                    CurrentPageSize = count % queryParam.PageSize;
                    if (CurrentPageSize == 0)
                    {
                        CurrentPageSize = queryParam.PageSize;
                    }
                }
                //取记录值
                //MYSQL : sb.AppendFormat("SELECT * FROM (SELECT * FROM (SELECT  {2}	FROM {3} {4} {5} LIMIT {1} ) TB2  {6}  LIMIT {0}) TB3 {5} ", CurrentPageSize, TotalRecordForPageIndex, queryParam.ReturnFields, queryParam.TableName, queryParam.Where, OrderBy, CutOrderBy);
                sb.AppendFormat(
                    "SELECT * FROM (SELECT TOP {0} * FROM (SELECT TOP {1} {2}	FROM {3} {4} {5}) TB2	{6}) TB3 {5} ",
                    CurrentPageSize, TotalRecordForPageIndex, queryParam.ReturnFields, queryParam.TableName,
                    queryParam.Where, OrderBy, CutOrderBy);
                cmd.CommandText = sb.ToString();
                dr = cmd.ExecuteReader();

                Dictionary <string, string> Fileds = new Dictionary <string, string>();
                foreach (DataRow var in dr.GetSchemaTable().Select())
                {
                    Fileds.Add(var[0].ToString(), var[0].ToString());
                }
                while (dr.Read())
                {
                    lst.Add(pd(dr, Fileds, _conStr));
                }
                dr.Close();
                dr.Dispose();
                dr.Close();
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return(lst);
        }
コード例 #17
0
ファイル: SqlDataProvider.cs プロジェクト: mind0n/hive
        /// <summary>
        /// 公共查询数据函数Sql存储过程版
        /// </summary>
        /// <param name="pd">委托对象</param>
        /// <param name="pp">查询字符串</param>
        /// <param name="RecordCount">返回记录总数</param>
        /// <returns>返回记录集ArrayList</returns>
        private ArrayList GetObjectList(PopulateDelegate pd, QueryParam pp, out int RecordCount)
        {
            ArrayList lst = new ArrayList();
            RecordCount = 0;
            using (SqlConnection conn = GetSqlConnection())
            {
                SqlCommand cmd = new SqlCommand("SupesoftPage", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                // 设置参数
                cmd.Parameters.Add("@TableName", SqlDbType.NVarChar, 500).Value = pp.TableName;
                cmd.Parameters.Add("@ReturnFields", SqlDbType.NVarChar, 500).Value = pp.ReturnFields;
                cmd.Parameters.Add("@Where", SqlDbType.NVarChar, 500).Value = pp.Where;
                cmd.Parameters.Add("@PageIndex", SqlDbType.Int).Value = pp.PageIndex;
                cmd.Parameters.Add("@PageSize", SqlDbType.Int).Value = pp.PageSize;
                cmd.Parameters.Add("@Orderfld", SqlDbType.NVarChar, 200).Value = pp.Orderfld;
                cmd.Parameters.Add("@OrderType", SqlDbType.Int).Value = pp.OrderType;
                // 执行
                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    lst.Add(pd(dr));
                }
                // 取记录总数 及页数
                if (dr.NextResult())
                {
                    if (dr.Read())
                    {
                        RecordCount = Convert.ToInt32(dr["RecordCount"]);
                    }
                }

                dr.Close();
                cmd.Dispose();
                conn.Close();
            }
            return lst;
        }
コード例 #18
0
ファイル: SqlDataProvider.cs プロジェクト: liu4434004/EHR2
        /// <summary>
        /// 返回sys_OnlineTable实体类的ArrayList对象
        /// </summary>
        /// <param name="qp">查询类</param>
        /// <param name="RecordCount">返回记录总数</param>
        /// <returns>sys_OnlineTable实体类的ArrayList对象</returns>
        public override ArrayList sys_OnlineList(QueryParam qp, out int RecordCount)
        {
            PopulateDelegate mypd = new PopulateDelegate(base.Populatesys_Online);

            return(this.GetObjectList(mypd, qp, out RecordCount));
        }
コード例 #19
0
ファイル: FriendsManager.cs プロジェクト: pederjohnsen/Nimbus
 public void StartPopulate(string friends)
 {
     PopulateDelegate p = new PopulateDelegate(Populate);
     p.BeginInvoke(friends, new AsyncCallback(PopulateComplete),null);
 }
コード例 #20
0
        public void StartPopulate(string friends)
        {
            PopulateDelegate p = new PopulateDelegate(Populate);

            p.BeginInvoke(friends, new AsyncCallback(PopulateComplete), null);
        }
コード例 #21
0
ファイル: SqlDataProvider.cs プロジェクト: liu4434004/EHR2
        /// <summary>
        /// 返回sys_ModuleExtPermissionTable实体类的ArrayList对象
        /// </summary>
        /// <param name="qp">查询类</param>
        /// <param name="RecordCount">返回记录总数</param>
        /// <returns>sys_ModuleExtPermissionTable实体类的ArrayList对象</returns>
        public override ArrayList sys_ModuleExtPermissionList(QueryParam qp, out int RecordCount)
        {
            PopulateDelegate mypd = new PopulateDelegate(base.Populatesys_ModuleExtPermission);

            return(this.GetObjectList(mypd, qp, out RecordCount));
        }