当前位置: 首页>>代码示例>>C#>>正文


C# List.ToArray方法代码示例

本文整理汇总了C#中Model.List.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToArray方法的具体用法?C# List.ToArray怎么用?C# List.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model.List的用法示例。


在下文中一共展示了List.ToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPlistVisitingLogTrs

 public List<DicReader> GetPlistVisitingLogTrs(string key, DateTime? leftVisitOn, DateTime? rightVisitOn, PagingInput paging)
 {
     paging.Valid();
     if (key != null)
     {
         key = key.Trim();
     }
     Func<SqlFilter> filter = () =>
     {
         var parameters = new List<DbParameter>();
         var filterString = @" where a.LoginName like @key ";
         parameters.Add(CreateParameter("key", "%" + key + "%", DbType.String));
         if (leftVisitOn.HasValue)
         {
             parameters.Add(CreateParameter("leftVisitOn", leftVisitOn.Value, DbType.DateTime));
             filterString += " and a.VisitOn>[email protected]";
         }
         if (rightVisitOn.HasValue)
         {
             parameters.Add(CreateParameter("rightVisitOn", rightVisitOn.Value, DbType.DateTime));
             filterString += " and a.VisitOn<@rightVisitOn";
         }
         return new SqlFilter(filterString, parameters.ToArray());
     };
     return base.GetPlist("VisitingLog", filter, paging);
 }
开发者ID:mingkongbin,项目名称:anycmd,代码行数:26,代码来源:VisitingLogQuery.cs

示例2: GetAllCategories

        public Category[] GetAllCategories()
        {
            List<Category> myCategories = new List<Category>();
            SqlConnection myConn = new SqlConnection(connstring);
            myConn.Open();

                SqlCommand mySqlCommand = new SqlCommand("select * from Category", myConn);
                SqlDataReader reader = mySqlCommand.ExecuteReader();

            while (reader.Read())
            {
                Category myCategory = new Category();
                object id = reader["Id"];

                if (id != null)
                {
                    int categoryId = -1;
                    if (!int.TryParse(id.ToString(), out categoryId))
                    {
                        throw new Exception("Failed to parse Id of video.");
                    }
                    myCategory.Id = categoryId;
                }

                myCategory.Name = reader["Name"].ToString();

                myCategories.Add(myCategory);
            }

            myConn.Close();

            return myCategories.ToArray();
        }
开发者ID:esteban1000,项目名称:videomanager,代码行数:33,代码来源:MsDatabase.cs

示例3: InsertBatch

        static void InsertBatch()
        {
            Console.WriteLine("Inserting a bunch of trial data objects...");

            var trialBatch = new List<Model.TrialData>();
            var random = new Random();

            var watch = new Stopwatch();
            watch.Start();
            for(int i=1; i<=50000; i++)
            {
                var parameters = new List<Parameter> {new Parameter { Name = "GBP.TotalReturnIndex", TrialNumber = 1, Value = random.NextDouble() },
                                                      new Parameter { Name = "USD.TotalReturnIndex", TrialNumber = 2, Value = random.NextDouble() },
                                                      new Parameter { Name = "EUR.TotalReturnIndex", TrialNumber = 3, Value = random.NextDouble() }};
                var trialData = new TrialData { StressNumber = i, Parameters = parameters.ToArray() };

                //var ravenConnection = new RavenConnection { ServerUrl = "http://localhost:8081/", DatabaseName = "TrialData" };
                //Console.WriteLine("Inserting Stress {0}", i);
                //var ravenDB = new RavenDB();
                //var elapsed = ravenDB.PostTrialData(ravenConnection, trialData);
                //Console.WriteLine("insert complete in {0}ms", elapsed);
                trialBatch.Add(trialData);
            }

            var ravenConnection = new Model.RavenConnection { ServerUrl = "http://localhost:8081/", DatabaseName = "TrialData" };
            var ravenDB = new RavenDB();
            var elapsed = ravenDB.BulkInsertTrialData(ravenConnection, trialBatch);
            watch.Stop();

            //var elapsed = ravenDB.BulkInsertTrialDataEmbedded(ravenConnection, trialBatch);

            Console.WriteLine();
            Console.WriteLine("Operation complete in {0} minutes, {1} seconds and {2} milliseconds", watch.Elapsed.Minutes, watch.Elapsed.Seconds, watch.Elapsed.Milliseconds);
        }
开发者ID:ColinCarson,项目名称:Scratch,代码行数:34,代码来源:Program.cs

示例4: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ScrollViewer.SetVerticalScrollMode(CategoryPageGridView, ScrollMode.Disabled);
            CategoryPageViewModel categoryPageViewModel =
                           (CategoryPageViewModel)Resources["CategoryPageViewModel"];
            NavigationItem navigationItem = e.Parameter as NavigationItem;
            var task = Task.Factory.StartNew(async () =>
            {
                var bundle = await DownloadNavigationItem(navigationItem.ReferralId);
                var navigationItems = await DownloadNavigationItemsAsync();

                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High,
                    () =>
                    {
                        categoryPageViewModel.Content = bundle.Content[0];
                        var items =  new List<Content>(bundle.Content);
                        items.RemoveAt(0);
                        bundle.Content = items.ToArray();
                        categoryPageViewModel.Bundle = bundle;
                        categoryPageViewModel.NavigationItems = navigationItems;
                        LoadingGrid.Visibility = Visibility.Collapsed;
                        MySplitView.Visibility = Visibility.Visible;
                    }
                );
            });
            base.OnNavigatedTo(e);
        }
开发者ID:arnvanhoutte,项目名称:DeRedactie,代码行数:27,代码来源:CategoryPage.xaml.cs

示例5: ReadJson

 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     HaParams returnValue = null;
     var deserializationErrorMessage = "Could not read ha-params value";
     if (reader.TokenType == JsonToken.Integer)
     {
         returnValue = new HaParams {AssociatedHaMode = HaMode.Exactly, ExactlyCount = (long)reader.Value};
     }else if (reader.TokenType == JsonToken.StartArray)
     {
         var potentialReturnValue = new HaParams {AssociatedHaMode = HaMode.Nodes};
         var nodesList = new List<string>();
         do
         {
             reader.Read();
             if (!new[] {JsonToken.EndArray, JsonToken.String}.Contains(reader.TokenType))
             {
                 deserializationErrorMessage = "Could not read ha-params array value";
             }
             else if(reader.TokenType == JsonToken.String)
             {
                 nodesList.Add(reader.Value as string);
             }
         } while (reader.TokenType == JsonToken.String);
         potentialReturnValue.Nodes = nodesList.ToArray();
         returnValue = potentialReturnValue;
     }
     if (returnValue != null)
     {
         return returnValue;
     }
     throw new JsonSerializationException(deserializationErrorMessage);
 }
开发者ID:KristofferV,项目名称:EasyNetQ,代码行数:32,代码来源:HaParamsConverter.cs

示例6: GetPlistCatalogAccountTrs

        public List<DicReader> GetPlistCatalogAccountTrs(string key, string catalogCode
            , bool includeDescendants, PagingInput paging)
        {
            paging.Valid();
            if (string.IsNullOrEmpty(catalogCode))
            {
                throw new ArgumentNullException("catalogCode");
            }
            Func<SqlFilter> filter = () =>
            {
                var parameters = new List<DbParameter>();
                var filterString = " where (a.Name like @key or a.Code like @key or a.LoginName like @key)";
                parameters.Add(CreateParameter("key", "%" + key + "%", DbType.String));
                if (!includeDescendants)
                {
                    parameters.Add(CreateParameter("CatalogCode", catalogCode, DbType.String));
                    filterString += " and [email protected]";
                }
                else
                {
                    parameters.Add(CreateParameter("CatalogCode", catalogCode + "%", DbType.String));
                    filterString += " and a.CatalogCode like @CatalogCode";
                }
                return new SqlFilter(filterString, parameters.ToArray());
            };

            return base.GetPlist("CatalogAccountTr", filter, paging);
        }
开发者ID:mingkongbin,项目名称:anycmd,代码行数:28,代码来源:PrivilegeQuery.cs

示例7: GetPlistGroupAccountTrs

 public List<DicReader> GetPlistGroupAccountTrs(string key, Guid groupId, PagingInput paging)
 {
     paging.Valid();
     Func<SqlFilter> filter = () =>
     {
         var parameters = new List<DbParameter>();
         const string filterString = @" where (a.Name like @key
     or a.Code like @key
     or a.LoginName like @key) and [email protected]";
         parameters.Add(CreateParameter("key", "%" + key + "%", DbType.String));
         parameters.Add(CreateParameter("GroupId", groupId, DbType.Guid));
         return new SqlFilter(filterString, parameters.ToArray());
     };
     return base.GetPlist("GroupAccountTr", filter, paging);
 }
开发者ID:mingkongbin,项目名称:anycmd,代码行数:15,代码来源:AccountQuery.cs

示例8: UCOldPartsPalautusManager_DeleteEvent

        void UCOldPartsPalautusManager_DeleteEvent(object sender, EventArgs e)
        {
            try
            {

                List<string> listField = new List<string>();
                foreach (DataGridViewRow dr in dgvRData.Rows)
                {
                    object isCheck = dr.Cells["colCheck"].EditedFormattedValue;
                    if (isCheck != null && (bool)isCheck)
                    {
                        listField.Add(dr.Cells["return_id"].Value.ToString());
                    }
                }
                if (listField.Count == 0)
                {
                    MessageBoxEx.Show("请选择删除记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (MessageBoxEx.Show("确认要删除吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
                Dictionary<string, string> comField = new Dictionary<string, string>();
                comField.Add("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.DELETED).ToString());
                comField.Add("update_by", HXCPcClient.GlobalStaticObj.UserID);//修改人Id
                comField.Add("update_name", HXCPcClient.GlobalStaticObj.UserName);//修改人姓名
                comField.Add("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString());//修改时间  
                bool flag = DBHelper.BatchUpdateDataByIn("批量删除宇通旧件返厂单", "tb_maintain_oldpart_recycle", comField, "return_id", listField.ToArray());
                if (flag)
                {
                    BindPageData();
                    if (dgvRData.Rows.Count > 0)
                    {
                        dgvRData.CurrentCell = dgvRData.Rows[0].Cells[0];
                    }
                    MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("删除失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
开发者ID:caocf,项目名称:workspace-kepler,代码行数:48,代码来源:UCOldPartsPalautusManager.cs

示例9: SearchPreVisitList


//.........这里部分代码省略.........
                    conditionSb.Append(" AND dr_visit.drid = @drid ");
                    paraList.Add(new MySqlParameter("drid", drid));
                }

                if (visit_id > 0)
                {
                    conditionSb.Append(" AND pre.visit_id = @visit_id ");
                    paraList.Add(new MySqlParameter("visit_id", visit_id));
                }

                if (patient_id > 0)
                {
                    conditionSb.Append(" AND pre.patient_id = @patient_id ");
                    paraList.Add(new MySqlParameter("patient_id", patient_id));
                }

                if (pre_date1.HasValue)
                {
                    conditionSb.Append(" AND DATEDIFF(pre.pre_date,@pre_date1) >= 0 ");
                    paraList.Add(new MySqlParameter("pre_date1", pre_date1.Value));
                }

                if (pre_date2.HasValue)
                {
                    conditionSb.Append(" AND DATEDIFF(pre.pre_date,@pre_date2) <= 0 ");
                    paraList.Add(new MySqlParameter("pre_date2", pre_date2.Value));
                }

                if (!string.IsNullOrEmpty(pre_time))
                {
                    conditionSb.Append(" AND pre.pre_time = @pre_time ");
                    paraList.Add(new MySqlParameter("pre_time", pre_time));
                }

                if (pre_type > 0)
                {
                    conditionSb.Append(" AND pre.pre_type = @pre_type ");
                    paraList.Add(new MySqlParameter("pre_type", pre_type));
                }

                if (visit_date1.HasValue)
                {
                    conditionSb.Append(" AND DATEDIFF(pre.createtime,@createtime1) >= 0 ");
                    paraList.Add(new MySqlParameter("createtime1", createtime1.Value));
                }

                if (createtime2.HasValue)
                {
                    conditionSb.Append(" AND DATEDIFF(pre.createtime,@createtime2) <= 0 ");
                    paraList.Add(new MySqlParameter("createtime2", createtime2.Value));
                }

                if (status > 0)
                {
                    conditionSb.Append(" AND dr_visit.status = @status ");
                    paraList.Add(new MySqlParameter("status", status));
                }

                if (visit_date1.HasValue)
                {
                    conditionSb.Append(" AND DATEDIFF(dr_visit.visit_date,@visit_date1) >= 0 ");
                    paraList.Add(new MySqlParameter("visit_date1", visit_date1.Value));
                }

                if (visit_date2.HasValue)
                {
                    conditionSb.Append(" AND DATEDIFF(dr_visit.visit_date,@visit_date2) <= 0 ");
                    paraList.Add(new MySqlParameter("visit_date2", visit_date2.Value));
                }

                #endregion

                #region 排序 分页
                string orderbyStr = string.Empty;
                if (!string.IsNullOrEmpty(orderbyCol) && orderby.HasValue)
                    orderbyStr = orderbyFormat.getSortStr(orderby.Value, orderbyCol);
                else
                    orderbyStr = " order by pre.pkid ";

                selectSql += conditionSb.ToString() + orderbyStr;
                if (pageIndex > 0)
                {
                    selectSql += " LIMIT @pageIndex , @pageSize ";
                    paraList.Add(new MySqlParameter("pageIndex", (pageIndex - 1) * pageSize));
                    paraList.Add(new MySqlParameter("pageSize", pageSize));
                }
                #endregion

                #region 执行

                var resultList = db.Database.SqlQuery<dr_pre_visit>(selectSql, paraList.ToArray()).ToList();
                return resultList;
                #endregion
            }
            catch (Exception ex)
            {
                error += BaseTool.FormatExceptionMessage(ex);
                return null;
            }
        }
开发者ID:lehprject,项目名称:sfjyDMS,代码行数:101,代码来源:dr_visit_DA.cs

示例10: UCPersonnelManager_DeleteEvent

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void UCPersonnelManager_DeleteEvent(object sender, EventArgs e)
        {

            List<string> listField = new List<string>();
            List<DataGridViewRow> deleteUser = new List<DataGridViewRow>();
            foreach (DataGridViewRow dr in dgvUser.Rows)
            {
                object isCheck = dr.Cells["colCheck"].EditedFormattedValue;
                if (isCheck != null && (bool)isCheck)
                {
                    listField.Add(dr.Cells["user_id"].Value.ToString());
                    deleteUser.Add(dr);
                }
            }
            if (listField.Count == 0)
            {
                MessageBoxEx.Show("请选择删除记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBoxEx.ShowQuestion("是否确认删除?"))
            {
                Dictionary<string, string> comField = new Dictionary<string, string>();
                comField.Add("enable_flag", "0");
                bool flag = DBHelper.BatchUpdateDataByIn("批量删除人员", "sys_user", comField, "user_id", listField.ToArray());
                if (flag)
                {
                    UploadUserData(listField);
                    BindPageData();
                    if (dgvUser.Rows.Count > 0)
                    {
                        dgvUser.CurrentCell = dgvUser.Rows[0].Cells[0];
                    }
                    MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LocalCache._Update(CacheList.User);
                }
                else
                {
                    MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
开发者ID:caocf,项目名称:workspace-kepler,代码行数:46,代码来源:UCPersonnelManager.cs

示例11: SelectGroups

        protected override TestGroup[] SelectGroups(TestNode testNode)
        {
            List<TestGroup> groups = new List<TestGroup>();

            foreach (XmlNode node in testNode.Xml.SelectNodes("properties/property[@name='Category']"))
            {
                var groupName = node.Attributes["value"].Value;
                var group = Groups.Find((g) => g.Name == groupName);//GetGroup(groupName);
                if (group == null)
                {
                    group = new TestGroup(groupName);
                    Groups.Add(group);
                    groups.Add(group);
                }
            }

            if (groups.Count == 0)
                groups.Add(Groups[0]);

            return groups.ToArray();
        }
开发者ID:mi-tettamanti,项目名称:nunit-gui,代码行数:21,代码来源:CategoryGrouping.cs

示例12: SqlBulkByTransNoLogNoBackUp

 /// <summary> SQLBulk方式操作带事务无操作备份
 /// </summary>
 /// <param name="connStr">数据库连接串</param>
 /// <param name="tableName">表名</param>
 /// <param name="listRow">DataRowList集合</param>
 /// <returns>SQLBulk批处理方式操作带事务,执行结果。全部成功,返回Bool True; 否则,返回False。</returns>
 public static bool SqlBulkByTransNoLogNoBackUp(string connStr, string tableName, List<DataRow> listRow)
 {
     if (listRow.Count == 0)
     {
         return true;
     }
     using (SqlConnection conn = new SqlConnection(connStr))
     {
         conn.Open();
         SqlTransaction tran = conn.BeginTransaction();
         using (SqlBulkCopy bulkCopy = new SqlBulkCopy(conn, SqlBulkCopyOptions.CheckConstraints, tran))
         {
             bulkCopy.DestinationTableName = tableName;
             bulkCopy.BulkCopyTimeout = 300;
             DataTable dt = listRow[0].Table;
             foreach (DataColumn dc in dt.Columns)
             {
                 bulkCopy.ColumnMappings.Add(dc.ColumnName, dc.ColumnName);
             }
             try
             {
                 bulkCopy.WriteToServer(listRow.ToArray());
                 tran.Commit();
                 return true;
             }
             catch (Exception ex)
             {
                 tran.Rollback();
                 throw ex;
             }
             finally
             {
                 bulkCopy.Close();
                 tran.Dispose();
             }
         }
     }
 }
开发者ID:caocf,项目名称:workspace-kepler,代码行数:44,代码来源:SqlHelper.cs

示例13: Update

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Wgw_listEntity model)
        {
            StringBuilder strSql = new StringBuilder();
            List<SqlParameter> parameters = new List<SqlParameter>();
            strSql.Append("update Wgw_list set ");

            if (!string.IsNullOrEmpty(model.typeone))
            {
                strSql.Append(" typeone = @typeone , ");
                parameters.Add(new SqlParameter("@typeone", model.typeone));
            }
            if (!string.IsNullOrEmpty(model.typetwo))
            {
                strSql.Append(" typetwo = @typetwo , ");
                parameters.Add(new SqlParameter("@typetwo", model.typetwo));
            }
            if (true)
            {
                strSql.Append(" pid = @pid , ");
                parameters.Add(new SqlParameter("@pid", model.pid));
            }

            if (true)
            {
                strSql.Append(" clientid = @clientid , ");
                parameters.Add(new SqlParameter("@clientid", model.clientid));
            }

            if (!string.IsNullOrEmpty(model.listname))
            {
                strSql.Append(" listname = @listname , ");
                parameters.Add(new SqlParameter("@listname", model.listname));
            }
            if (!string.IsNullOrEmpty(model.listdesc))
            {
                strSql.Append(" listdesc = @listdesc , ");
                parameters.Add(new SqlParameter("@listdesc", model.listdesc));
            }
            if (true)
            {
                strSql.Append(" listorder = @listorder , ");
                parameters.Add(new SqlParameter("@listorder", model.listorder));
            }

            if (!string.IsNullOrEmpty(model.listcover))
            {
                strSql.Append(" listcover = @listcover , ");
                parameters.Add(new SqlParameter("@listcover", model.listcover));
            }
            strSql.Append(" isshow = @isshow , ");
            parameters.Add(new SqlParameter("@isshow", model.isshow));

            if (!string.IsNullOrEmpty(model.icon))
            {
                strSql.Append(" icon = @icon , ");
                parameters.Add(new SqlParameter("@icon", model.icon));
            } strSql = strSql.Remove(strSql.Length - 2, 2);
            strSql.Append(" where [email protected] ");
            parameters.Add(new SqlParameter("@id", model.id));
            int rows = DBExecuteUtil.ExecuteSqlWithParams(strSql.ToString(), parameters.ToArray());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:sst330381,项目名称:TW9iaWxlTW9kdWxl,代码行数:72,代码来源:DALWgw_list.cs

示例14: CreateNewActionReference

		protected CodeExpression CreateNewActionReference(ActionTreeNode node, List<CodeExpression> actionArguments, List<string> actionArgumentTypes)
		{
			var actionArgumentRuntimeTypes = new List<CodeExpression>();
			foreach (var type in actionArgumentTypes)
				actionArgumentRuntimeTypes.Add(new CodeTypeOfExpression(source[type]));
			
			CodeExpression createMethodSignature = new CodeObjectCreateExpression(
				source[typeof (MethodSignature)],
				new CodeExpression[]
				{
					new CodeTypeOfExpression(node.Controller.FullName),
					new CodePrimitiveExpression(node.Name),
					new CodeArrayCreateExpression(source[typeof (Type)], actionArgumentRuntimeTypes.ToArray())
				});

			var constructionArguments = new[]
			{
				new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), naming.ToMemberVariableName(serviceIdentifier)),
				new CodeTypeOfExpression(node.Controller.FullName),
				new CodePrimitiveExpression(node.Controller.Area),
				new CodePrimitiveExpression(naming.ToControllerName(node.Controller.Name)),
				new CodePrimitiveExpression(node.Name),
				createMethodSignature,
				new CodeArrayCreateExpression(source[typeof (ActionArgument)], actionArguments.ToArray())
			};

			return new CodeMethodInvokeExpression(
				new CodeMethodReferenceExpression(
					new CodePropertyReferenceExpression(
						new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), naming.ToMemberVariableName(serviceIdentifier)),
						"ControllerReferenceFactory"),
					"CreateActionReference"),
				constructionArguments);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:34,代码来源:ActionMapGenerator.cs

示例15: SearchDruginfoList

        public List<md_druginfo> SearchDruginfoList(string drugname, string standard, int producerid, string cust_name, string sub_name,
            orderbyEnum? orderby, string orderbyCol, int pageIndex, int pageSize, out string error)
        {
            error = string.Empty;
            try
            {
                #region Command

                string selectSql = string.Format("select * from md_druginfo WHERE TRUE ");

                StringBuilder conditionSb = new System.Text.StringBuilder();

                List<MySqlParameter> paraList = new List<MySqlParameter>();
                #endregion

                #region 搜索条件
                if (!string.IsNullOrEmpty(drugname))
                {
                    conditionSb.Append(" AND drugname LIKE CONCAT('%', @drugname, '%') ");
                    paraList.Add(new MySqlParameter("drugname", drugname));
                }

                if (!string.IsNullOrEmpty(standard))
                {
                    conditionSb.Append(" AND standard LIKE CONCAT('%', @standard, '%') ");
                    paraList.Add(new MySqlParameter("standard", standard));
                }

                if (producerid > 0)
                {
                    conditionSb.Append("AND producerid = @producerid");
                    paraList.Add(new MySqlParameter("producerid", producerid));
                }

                if (!string.IsNullOrEmpty(cust_name))
                {
                    conditionSb.Append(" AND cust_name LIKE CONCAT('%', @cust_name, '%') ");
                    paraList.Add(new MySqlParameter("cust_name", cust_name));
                }

                if (!string.IsNullOrEmpty(sub_name))
                {
                    conditionSb.Append(" AND sub_name LIKE CONCAT('%', @sub_name, '%') ");
                    paraList.Add(new MySqlParameter("sub_name", sub_name));
                }

                #endregion

                #region 排序 分页
                string orderbyStr = string.Empty;
                if (!string.IsNullOrEmpty(orderbyCol) && orderby.HasValue)
                    orderbyStr = orderbyFormat.getSortStr(orderby.Value, orderbyCol);
                else
                    orderbyStr = " order by pkid ";

                selectSql += conditionSb.ToString() + orderbyStr;
                if (pageIndex > 0)
                {
                    selectSql += " LIMIT @pageIndex , @pageSize ";
                    paraList.Add(new MySqlParameter("pageIndex", (pageIndex - 1) * pageSize));
                    paraList.Add(new MySqlParameter("pageSize", pageSize));
                }
                #endregion

                #region 执行

                var resultList = sqlHelper.ExecuteObjects<md_druginfo>(selectSql, paraList.ToArray()).ToList();
                return resultList;
                #endregion
            }
            catch (Exception ex)
            {
                error += BaseTool.FormatExceptionMessage(ex);
                return null;
            }
        }
开发者ID:lehprject,项目名称:sfjyDMS,代码行数:76,代码来源:md_druginfo_DA.cs


注:本文中的Model.List.ToArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。