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


C# Select.Read方法代码示例

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


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

示例1: mark_loaded_on_board_deprecated

    /// <summary>
    /// deprecated code can't get this to work
    /// </summary>
    /// <param name="containerid"></param>
    /// <returns></returns>
    protected bool mark_loaded_on_board_deprecated(int containerid)
    {
        bool _onboard = true;
        DateTime _currentdate = DateTime.Now;
        int _result = 0;
        int _statusid = 12;
        //containerid 7 or 16316 was good for testing
        using (SharedDbConnectionScope _sc = new SharedDbConnectionScope())
        {
            using (System.Transactions.TransactionScope _ts = new System.Transactions.TransactionScope())
            {
                try
                {
                    //deprecated code
                    //SubSonic.Query _qry1 = new SubSonic.Query(DAL.Logistics.Tables.ContainerTable);
                    //_qry1.QueryType = QueryType.Update;
                    //_qry1.AddUpdateSetting("LoadedOnBoard", _onboard);
                    //_qry1.AddUpdateSetting("Updated", DateTime.Now.ToShortDateString());
                    //_qry1.WHERE("ContainerID", Comparison.Equals, containerid);
                    //*************

                    //for testing q1 ********
                    //SqlQuery _s1 = new Select(DAL.Logistics.Tables.ContainerTable);
                    //_s1.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid);
                    //DataTable _dt1 = _s1.ExecuteDataSet().Tables[0];

                    Update _q1 = new Update(DAL.Logistics.Tables.ContainerTable);
                    _q1.Set(DAL.Logistics.ContainerTable.LoadedOnBoardColumn).EqualTo(_onboard);
                    _q1.Set(DAL.Logistics.ContainerTable.UpdatedColumn).EqualTo(_currentdate);
                    _q1.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid);
                    //string _test = _q1.ToString();
                    _result = _q1.Execute();

                    //2. get associated orderid's
                    //OrderTableCollection _q2 = new Select().From(DAL.Logistics.Tables.OrderTable)
                    //.InnerJoin(DAL.Logistics.ContainerSubTable.OrderIDColumn, DAL.Logistics.OrderTable.OrderIDColumn)
                    //.InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn)
                    //.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid).ExecuteAsCollection<OrderTableCollection>();

                    //update records
                    //    for (int _ix = 0; _ix < _q2.Count; _ix++)
                    //   {
                    //       _q2[_ix].ShippedOnBoard = _onboard;
                    //      
                    //   }
                    //
                    //    _q2.SaveAll(); 
                    
                    //2. get associated orderid's as typed list
                    IList<int> _s2 = new Select("OrderID").From(DAL.Logistics.Tables.OrderTable)
                    .InnerJoin(DAL.Logistics.ContainerSubTable.OrderIDColumn, DAL.Logistics.OrderTable.OrderIDColumn)
                    .InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn)
                    .Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid).ExecuteTypedList<int>();

                    for (int _ix = 0; _ix < _s2.Count; _ix++)
                    {
                        //Update _q2 = new Update(DAL.Logistics.Tables.OrderTable);
                        //_q2.Set(DAL.Logistics.OrderTable.ShippedOnBoardColumn).EqualTo(_onboard);
                        //_q2.Where(DAL.Logistics.OrderTable.OrderIDColumn).InValues. 
                    }
                    //can't use IN for update as container id is a nullable coumn
                    //Update _q2 = new Update(DAL.Logistics.Tables.OrderTable);
                    //_q2.Set(DAL.Logistics.OrderTable.ShippedOnBoardColumn).EqualTo(_onboard);
                    //_q2.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).In(_s2);
                    //string _test = _q2.ToString();
                    //_q2.Execute();

                    //can't use an update query here as there will likely be multiple orders to update and you will get 'multi-part identifier can't be bound'
                    //Update _q2 = new Update(DAL.Logistics.Tables.OrderTable);
                    //    _q2.Set(DAL.Logistics.OrderTable.ShippedOnBoardColumn).EqualTo(_onboard);
                    //    _q2.From(DAL.Logistics.Tables.OrderTable);
                    //    _q2.InnerJoin(DAL.Logistics.ContainerSubTable.OrderIDColumn, DAL.Logistics.OrderTable.OrderIDColumn);
                    //    _q2.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid); //.Execute();
                    //    string _test = _q2.ToString(); 
                    //**********************

                    string[] _cols = { "DeliverySubTable.DeliveryID", "VoyageETSSubTable.ETS" };
                    //SqlQuery _s3 = new Select(_cols).From(DAL.Logistics.Tables.DeliverySubTable)
                    //.InnerJoin(DAL.Logistics.ContainerSubTable.OrderNumberColumn, DAL.Logistics.DeliverySubTable.OrderNumberColumn)
                    //.InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn)
                    //.InnerJoin(DAL.Logistics.OrderTable.OrderIDColumn, DAL.Logistics.ContainerSubTable.OrderIDColumn)
                    //.InnerJoin(DAL.Logistics.VoyageTable.VoyageIDColumn, DAL.Logistics.ContainerTable.VoyageIDColumn)
                    //.InnerJoin(DAL.Logistics.VoyageETSSubTable.VoyageIDColumn, DAL.Logistics.VoyageTable.VoyageIDColumn)
                    //.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid)
                    //.And(DAL.Logistics.DeliverySubTable.CurrentStatusIDColumn).IsEqualTo(1);
                    //string _test = _s3.ToString(); 

                    ///q3. get data we need ets from VoyageEtsSubtable so return a datareader and then build collection
                    IDataReader _rd = new Select(_cols).From(DAL.Logistics.Tables.DeliverySubTable)
                    .InnerJoin(DAL.Logistics.ContainerSubTable.OrderNumberColumn, DAL.Logistics.DeliverySubTable.OrderNumberColumn)
                    .InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn)
                    .InnerJoin(DAL.Logistics.OrderTable.OrderIDColumn, DAL.Logistics.ContainerSubTable.OrderIDColumn)
                    .InnerJoin(DAL.Logistics.VoyageTable.VoyageIDColumn, DAL.Logistics.ContainerTable.VoyageIDColumn)
                    .InnerJoin(DAL.Logistics.VoyageETSSubTable.VoyageIDColumn, DAL.Logistics.VoyageTable.VoyageIDColumn)
                    .Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid)
//.........这里部分代码省略.........
开发者ID:Publiship,项目名称:WWI_CRM_folders,代码行数:101,代码来源:mark_container.aspx.cs


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