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


C# DCFactory类代码示例

本文整理汇总了C#中DCFactory的典型用法代码示例。如果您正苦于以下问题:C# DCFactory类的具体用法?C# DCFactory怎么用?C# DCFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetFeedbackRecipients

 public static FeedbackRecipient[] GetFeedbackRecipients(string locale)
 {
     using( var dc = new DCFactory<CmsDataContext>() )
     {
         if (locale != "ru-RU")
         {
             //TODO получается как-то громоздко, но времени в обрез, а справочник этот небольшой, поэтому оставляем так (главное что работает)
             var recipients = from rpts in dc.DataContext.FeedbackRecipients
                              join
                                 locs in dc.DataContext.FeedbackRecipientsLocs on rpts.RecipientID equals locs.RecipientID
                              where locs.Localization == locale
                              select new
                              {
                                  RecipientID = rpts.RecipientID,
                                  RecipientEmail = rpts.RecipientEmail,
                                  RecipientVisible = rpts.RecipientVisible,
                                  RecipientName = locs.RecipientName
                              };
             var recipients_materialized = recipients.ToArray();
             return recipients_materialized.Select(r => new FeedbackRecipient
             {
                 RecipientID = r.RecipientID,
                 RecipientEmail = r.RecipientEmail,
                 RecipientVisible = r.RecipientVisible,
                 RecipientName = r.RecipientName
             }).ToArray();
         }
         else
         {
             return _getFeedbackRecipients(dc.DataContext).ToArray();
         }
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:33,代码来源:FeedbackDac.cs

示例2: Page_PreRender

        protected void Page_PreRender( object sender, EventArgs e )
        {
            using( var dc = new DCFactory<CmsDataContext>() )
            {
                var groups = dc.DataContext.CatalogItems.GroupBy( c => c.ParentItemID ).ToDictionary( g => g.Key ?? 0 );

                if( groups.Count != 0 )
                {
                    var list = new List<object>();
                    var stack = new Stack<KeyValuePair<CatalogItem,int>>();

                    foreach( var item in groups[ 0 ].OrderByDescending( c=>c.CatalogItemPriority ) )
                        stack.Push( new KeyValuePair<CatalogItem, int>( item, 0 ) );

                    while( stack.Count != 0 )
                    {
                        var node = stack.Pop();
                        list.Add( new { CatalogItem = node.Key, Level = node.Value } );

                        if( groups.ContainsKey( node.Key.CatalogItemID ) )
                        {
                            foreach( var item in groups[ node.Key.CatalogItemID ].OrderByDescending( c => c.CatalogItemPriority ) )
                                stack.Push( new KeyValuePair<CatalogItem, int>( item, node.Value + 1 ) );
                        }
                    }

                    _repeater.DataSource = list;
                    _repeater.DataBind();
                }

            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:32,代码来源:List.aspx.cs

示例3: GetProfileByUsername

 public static UserProfileEntry GetProfileByUsername(string username)
 {
     using (var dc = new DCFactory<StoreDataContext>())
     {
         return _getEntriesByUsername(dc.DataContext, username).SingleOrDefault();
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:7,代码来源:UserProfileDac.cs

示例4: GetAlertConfigByClientId

 //public static UserProfileEntry GetProfileByUserId(int userId)
 //{
 //    using (var dc = new StoreDataContext())
 //    {
 //        return _getEntriesByUserId(dc, userId).SingleOrDefault();
 //    }
 //}
 public static ClientAlertConfig GetAlertConfigByClientId(string clientId)
 {
     using (var dc = new DCFactory<StoreDataContext>())
     {
         return _getAlertConfigByClientId(dc.DataContext, clientId).SingleOrDefault();
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:14,代码来源:ClientAlertConfigDac.cs

示例5: GetSparePartGroups

 public static SparePartGroup[] GetSparePartGroups()
 {
     using( var dc = new DCFactory<CmsDataContext>() )
     {
         return _getSparePartGroups( dc.DataContext ).ToArray();
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:7,代码来源:SparePartGroupsDac.cs

示例6: LoadItems

 public IEnumerable<ShoppingCartItem> LoadItems()
 {
     using (var context = new DCFactory<StoreDataContext>())
     {
         return LoadItems(context.DataContext);
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:7,代码来源:PersistentShoppingCartStorage.cs

示例7: GetEntries

 public static UserMaintEntry[] GetEntries(string username)
 {
     using (var dc = new DCFactory<StoreDataContext>())
     {
         return _getEntriesByUsername(dc.DataContext, username).ToArray();
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:7,代码来源:UserMaintDac.cs

示例8: GetFileIDByName

 /// <summary>
 /// Возвращает ID файла по его наименованию
 /// </summary>
 /// <param name="fileName">Имя файла</param>
 /// <returns>ID файла</returns>
 public static int GetFileIDByName(string fileName)
 {
     using (var dc = new DCFactory<CmsDataContext>())
     {
         return _getFileIDByFileName(dc.DataContext, fileName);
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:12,代码来源:FilesDac.cs

示例9: GetFolderPath

        public static string GetFolderPath( int folderID )
        {
            using(var dc = new DCFactory<CmsDataContext>())
            {
                Folder folder = _getFolderById( dc.DataContext, folderID );

                if( folder != null )
                {
                    List<Folder> list = new List<Folder>();
                    for( Folder f = folder ; f != null ; f = f.Parent )
                    {
                        list.Add( f );
                    }

                    list.Reverse();

                    StringBuilder sb = new StringBuilder();
                    foreach( Folder f in list )
                    {
                        if( sb.Length != 0 ) sb.Append( " / " );
                        sb.Append( f.FolderName );
                    }
                    return sb.ToString();
                }
                else
                {
                    return null;
                }
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:30,代码来源:FilesDac.cs

示例10: Page_Load

        protected void Page_Load( object sender, EventArgs e )
        {
            using (var ctx = new DCFactory<StoreDataContext>())
            {
                this.Mfr = Request.QueryString.TryGet<string>( UrlKeys.StoreAndTecdoc.ManufacturerName, String.Empty );
                _pageTitleLiteral.Text = String.Format( "{0} / {1}", CmsContext.Current.CatalogItem.CatalogItemName, this.Mfr );

                var ids = StocksConfiguration.Current.SupplierIds;
                ctx.DataContext.Log = new RmsAuto.Common.Misc.DebuggerWriter();

                throw new NotImplementedException();

                //TODO: Возможно тут стоит переписать через SparePartsDac
                //var sps = ctx.DataContext.SpareParts.Where( sp => sp.Manufacturer == this.Mfr )
                //            .Where( sp => ids.Contains( sp.SupplierID ) )
                //            .OrderBy( sp => sp.PartDescription )
                //            .ThenBy( sp => sp.InitialPrice );

                //var pageSize = StocksConfiguration.Current.PageSize;

                //var pages = new int[ (int)Math.Ceiling( (decimal)sps.Count() / (decimal)pageSize ) ];
                //for( int j = 0 ; j < pages.Length ; j++ )
                //{
                //    pages[ j ] = j + 1;
                //}

                //rptPaging.DataSource = pages;
                //rptPaging.DataBind();

                //rptParts.DataSource = sps.Skip( ( this.PageNum - 1 ) * pageSize ).Take( pageSize ).ToList();
                //rptParts.DataBind();
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:33,代码来源:StockSupplierParts.aspx.cs

示例11: InsertMessage

 public void InsertMessage(int clientId, int userTo, string msgText)
 {
     using (var ctx = new DCFactory<StoreDataContext>())
     {
         ctx.DataContext.ExecuteCommand("insert into UserMessages (User_From, user_To, Text) values ({0},{1},{2})", clientId, userTo, msgText);
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:7,代码来源:MessageRepository.cs

示例12: Load

 public static TransferChangesLogEntry Load(int logEntryId)
 {
     using (var context = new DCFactory<StoreDataContext>())
     {
         return context.DataContext.TransferChangesLogEntries.Single(tcle => tcle.LogEntryID == logEntryId);
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:7,代码来源:TransferChangesLogEntry.cs

示例13: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Dictionary<byte, string> dNames = new Dictionary<byte, string>();

                using (var dc = new DCFactory<StoreDataContext>())
                {
                    //deas 30.03.2011 task3586
                    // добавлена сортировка и условие отображения
                    foreach ( var statusElement in dc.DataContext.OrderLineStatuses.OrderBy(t => t.ClientShowOrder))
                    {
                        var status = statusElement.OrderLineStatusID;
                        if (OrderLineStatusUtil.IsShow(status))
                        {
                            dNames.Add( status, OrderLineStatusUtil.DisplayName( status ) );
                        }
                    }
                }

                _listView.DataSource = dNames;
                _listView.DataBind();

                InitControls();
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:26,代码来源:NotificationConfig.ascx.cs

示例14: _btnChangeStatus_Click

        protected void _btnChangeStatus_Click(object sender, EventArgs e)
        {
            int orderID = -1; int.TryParse(_txtOrderID.Text.Trim(), out orderID); if (orderID < 0) return;
            using (var dc = new DCFactory<StoreDataContext>())
            {
                for (int i = 0; i < _gvOrderLines.Rows.Count; i++)
                {
                    if (!((CheckBox)_gvOrderLines.Rows[i].Cells[0].Controls[0]).Checked) continue;
                    DataControlFieldCell cb = (DataControlFieldCell)_gvOrderLines.Rows[i].Cells[2];
                    int orderLineID; try { orderLineID = Convert.ToInt32(cb.Text); }
                    catch { continue; }
                    OrderLine line = dc.DataContext.OrderLines.FirstOrDefault(l => l.OrderLineID == orderLineID && l.OrderID == orderID);
                    if (line != null && line.CurrentStatus != OrderLineStatusUtil.StatusByte("Rejected"))
                    {
                        byte newStatus = 0;
                        byte.TryParse(_ddlStatuses.SelectedValue, out newStatus);
                        if (newStatus > 0)
                        {
                            //новая дата статуса
                            DateTime orderLineStatusDate;
                            try { orderLineStatusDate = DateTime.ParseExact(_txtStatusDate.Text, "dd.MM.yyyy", CultureInfo.InvariantCulture); }
                            catch { orderLineStatusDate = DateTime.Now; }
                            line.CurrentStatus = newStatus;
                            line.CurrentStatusDate = orderLineStatusDate;
                        }
                    }
                }
                dc.DataContext.SubmitChanges();
            }

            FillData();
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:32,代码来源:StatusesMgmt.aspx.cs

示例15: GetRequests

 public static IEnumerable<VinRequest> GetRequests(string clientId)
 {
     using (var ctx = new DCFactory<StoreDataContext>())
     {
         return _getClientVinRequests(ctx.DataContext, clientId).ToList();
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:7,代码来源:VinRequestsDac.cs


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