public static void ImportExcelData(Stream excel, VDMS.VDMSSetting.SettingData.WarrantySetting setting)
        {
            IExcelDataReader spreadsheet = ExcelReaderFactory.CreateBinaryReader(excel);

            var startRow = setting.StartRow;
            var dateFormat = setting.DateFormat;
            var partCodeCol = setting.PartCode;
            var partNameVNCol = setting.VietnameseName;
            var partNameENCol = setting.EnglishName;
            var motorCodeCol = setting.MotorCode;
            var warrantyTimeCol = setting.WarrantyTime;
            var warrantyLengthCol = setting.WarrantyLength;
            var startDateCol = setting.StartDate;
            var endDateCol = setting.EndDate;

            var rows = spreadsheet.AsDataSet().Tables[0].AsEnumerable();
            var query = from r in rows
                        select new
                        {
                            PartCode = partCodeCol == 0 || partCodeCol > r.ItemArray.Count() ? string.Empty : r.Field<string>(partCodeCol - 1),
                            PartNameVN = partNameVNCol == 0 || partNameVNCol > r.ItemArray.Count() ? string.Empty : r.Field<string>(partNameVNCol - 1),
                            PartNameEN = partNameENCol == 0 || partNameENCol > r.ItemArray.Count() ? string.Empty : r.Field<string>(partNameENCol - 1),
                            MotorCode = motorCodeCol == 0 || motorCodeCol > r.ItemArray.Count() ? string.Empty : r.Field<string>(motorCodeCol - 1),
                            WarrantyTime = warrantyTimeCol == 0 || warrantyTimeCol > r.ItemArray.Count() ? string.Empty : r.Field<string>(warrantyTimeCol - 1),
                            WarrantyLength = warrantyLengthCol == 0 || warrantyLengthCol > r.ItemArray.Count() ? string.Empty : r.Field<string>(warrantyLengthCol - 1),
                            StartDate = startDateCol == 0 || startDateCol > r.ItemArray.Count() ? string.Empty : r.Field<string>(startDateCol - 1),
                            EndDate = endDateCol == 0 || endDateCol > r.ItemArray.Count() ? string.Empty : r.Field<string>(endDateCol - 1),
                        };
            var data = query.Skip(startRow - 1).TakeWhile(v => !string.IsNullOrEmpty(v.PartCode));

            foreach (var item in data)
            {
                long temp;
                int tempInt;

                var newItem = new WarrantyCondition();

                newItem.PartCode = item.PartCode.Trim().ToUpper();
                newItem.PartNameVN = item.PartNameVN;
                newItem.PartNameEN = item.PartNameEN;
                newItem.MotorCode = item.MotorCode;
                newItem.WarrantyLength = long.TryParse(item.WarrantyLength, out temp) ? temp : 0;
                newItem.WarrantyTime = int.TryParse(item.WarrantyTime, out tempInt) ? tempInt : 0;
                newItem.StartDate = DataFormat.DateFromExcel(item.StartDate, dateFormat);
                newItem.StopDate = DataFormat.DateFromExcel(item.EndDate, dateFormat);
                newItem.SessionID = HttpContext.Current.Session.SessionID;

                _importingItems.Add(newItem);
            }
        }
partial         void UpdateReceiveHeader(VDMS.II.Entity.ReceiveHeader instance);
 partial void DeleteBonusTransaction(VDMS.Bonus.Entity.BonusTransaction instance);
 partial void DeleteOrderHeader(VDMS.Bonus.Entity.OrderHeader instance);
 partial void DeleteBonus(VDMS.Bonus.Entity.Bonus instance);
 partial void InsertBonus(VDMS.Bonus.Entity.Bonus instance);
 partial void InsertBonusPlanDetail(VDMS.Bonus.Entity.BonusPlanDetail instance);
 partial void UpdateBonusSource(VDMS.Bonus.Entity.BonusSource instance);
partial         void UpdateV2PPartReplacement(VDMS.II.Entity.V2PPartReplacement instance);
示例#10
0
partial         void UpdateTransferHeader(VDMS.II.Entity.TransferHeader instance);
示例#11
0
partial         void UpdateTransferDetail(VDMS.II.Entity.TransferDetail instance);
示例#12
0
partial         void UpdateTransactionHistory(VDMS.II.Entity.TransactionHistory instance);
示例#13
0
partial         void UpdateSystemData(VDMS.II.Entity.SystemData instance);
示例#14
0
partial         void UpdateSalesHeader(VDMS.II.Entity.SalesHeader instance);
示例#15
0
partial         void UpdateSalesDetail(VDMS.II.Entity.SalesDetail instance);
 partial void DeleteBonusPlanHeader(VDMS.Bonus.Entity.BonusPlanHeader instance);
 partial void InsertBonusSource(VDMS.Bonus.Entity.BonusSource instance);
示例#18
0
partial         void UpdateVehicle(VDMS.II.Entity.Vehicle instance);
 partial void DeleteBonusSource(VDMS.Bonus.Entity.BonusSource instance);
示例#20
0
partial         void UpdateVendor(VDMS.II.Entity.Vendor instance);
 partial void DeleteBonusPlanDetail(VDMS.Bonus.Entity.BonusPlanDetail instance);
示例#22
0
partial         void UpdateWarehouse(VDMS.II.Entity.Warehouse instance);
 partial void UpdateBonus(VDMS.Bonus.Entity.Bonus instance);
 partial void InsertDealer(VDMS.Bonus.Entity.Dealer instance);
 partial void InsertOrderHeader(VDMS.Bonus.Entity.OrderHeader instance);
 partial void UpdateDealer(VDMS.Bonus.Entity.Dealer instance);
 partial void InsertBonusTransaction(VDMS.Bonus.Entity.BonusTransaction instance);
 partial void DeleteDealer(VDMS.Bonus.Entity.Dealer instance);
        public static IQueryable<OrderDetail> GetBaseQuery(VDMS.II.Linq.PartDataContext dc, string dCode, string issueNo, DateTime oFrom, DateTime oTo, DateTime iFrom, DateTime iTo)
        {
            var query = dc.OrderDetails.Where(p => p.OrderHeader.Dealer.DatabaseCode == VDMS.Helper.UserHelper.DatabaseCode);

            if (!string.IsNullOrEmpty(dCode))
            {
                query = query.Where(p => p.OrderHeader.DealerCode == dCode);
            }
            if (!string.IsNullOrEmpty(issueNo))
            {
                query = query.Where(p => p.OrderHeader.ReceiveHeaders.Any(h => h.IssueNumber == issueNo));
            }
            if (oFrom > DateTime.MinValue)
            {
                query = query.Where(p => p.OrderHeader.OrderDate >= oFrom);
            }
            if (oTo > DateTime.MinValue)
            {
                query = query.Where(p => p.OrderHeader.OrderDate < oTo.AddDays(1).Date);
            }
            if (iFrom > DateTime.MinValue)
            {
                query = query.Where(p => p.OrderHeader.ReceiveHeaders.Any(h => h.ReceiveDate >= iFrom));
            }
            if (iTo > DateTime.MinValue)
            {
                query = query.Where(p => p.OrderHeader.ReceiveHeaders.Any(h => h.ReceiveDate < iTo.AddDays(1).Date));
            }

            return query;
        }
 partial void InsertBonusPlanHeader(VDMS.Bonus.Entity.BonusPlanHeader instance);