public void Import() { if (ImportList.Any() == false) { ShowMessage(new Models.Message("Thông báo", "Không có sách trong Phiếu nhập sách")); return; } PHIEUNHAPSACH p = new PHIEUNHAPSACH() { MATK = dataProvider.User.MATK, NGAYLAP = DateTime.Today }; dataProvider.Create <PHIEUNHAPSACH>(p); foreach (ImportItem item in ImportList) { for (int i = 0; i < item.Amount; i++) { CTSACH c = new CTSACH() { MASACH = item.BookId, MAPNS = p.MAPNS, GIABIA = item.CoverPrice, GIANHAP = item.ImportPrice, MATT = 1 }; dataProvider.Create <CTSACH>(c); } } HistoryList = dataProvider.GetImportBillList(x => true); ImportList = new BindableCollection <ImportItem>(); ShowMessage(new Models.Message("Thông báo", "Đã nhập thành công")); }
public override void ImportItems() { foreach (AbilitiModel ab in ImportList.Where(n => n.IsChecked)) { var fod = PersProperty.Abilitis.FirstOrDefault(n => n.NameOfProperty == ab.NameOfProperty); if (fod == null || Cha == null) { AbilitiModel cc = new AbilitiModel(ab, PersProperty); foreach (var needTaskse in ab.NeedTasks) { AddOrEditAbilityViewModel.CloneTask(needTaskse, 0, cc, false); } foreach (var source in cc.NeedTasks.ToList()) { source.TaskProperty.BeginDateProperty = MainViewModel.selectedTime; } if (Cha != null) { Cha.NeedAbilitisProperty.First(n => n.AbilProperty == cc).KoeficientProperty = 3; } } else { if (Cha != null) { Cha.NeedAbilitisProperty.First(n => n.AbilProperty == fod).KoeficientProperty = 3; } } } StaticMetods.AbillitisRefresh(PersProperty); StaticMetods.Locator.MainVM.RefreshTasksInMainView(); PersProperty.SellectedAbilityProperty = PersProperty.Abilitis.LastOrDefault(); }
public override void Init(AstContext context, ParseTreeNode treeNode) { base.Init(context, treeNode); var nodes = treeNode.GetMappedChildNodes(); var definitionOrStmt = nodes[0].ChildNodes; var importCount = 0; var definitionCount = 0; var stmtCount = 0; foreach (var node in definitionOrStmt) { if (node.Term.Name[0] == '$')//Chapus medio alto para saber si es import { ImportList.Add(AddChild("Import: " + importCount, node)); importCount++; } else if (node.Term.Name[0] == '#')//Chapus medio alto para saber si es definition { DefinitonList.Add(AddChild("Definition: " + definitionCount, node)); definitionCount++; } else { StmtList.Add(AddChild("stmt " + stmtCount, node)); stmtCount++; } } }
public void visitImportList(ImportList il) { GraphNode importList = new GraphNode(getNewId(), NodeType.ImportList, "Import List"); _graph.add(importList); addASTEdge(importList, ""); visitChildren(importList, il); }
public void Remove(ImportItem item) { MessageBoxResult messageBoxResult = MessageBox.Show("Bạn có muốn xóa phần tử này hay không?", "Cảnh báo", MessageBoxButton.OKCancel, MessageBoxImage.Warning); if (messageBoxResult == MessageBoxResult.OK) { ImportList.Remove(item); UpdateValue(); } }
public async Task <IActionResult> Delete(int id) { var list = new ImportList() { Id = id }; _context.Entry(list).State = EntityState.Deleted; await _context.SaveChangesAsync(); return(Ok()); }
public async Task TestDB() { var import = new ImportList() { Count = 1, Date = DateTime.UtcNow, UserId = Guid.NewGuid().ToString(), TargetName = Guid.NewGuid().ToString() }; _context.ImportLists.Add(import); await _context.SaveChangesAsync(); }
void ImportList_Hotkeys(object sender, KeyEventArgs e) { if ((e.Key == Key.Enter) && (ImportList.SelectedItems.Count == 1)) { StartEdit(ImportList.SelectedItems[0] as ImportFile); e.Handled = true; ImportList.Focus(); } else if (e.Key == Key.Delete) { MarkDeleteSelected(); e.Handled = true; ImportList.Focus(); } }
/// <summary> /// Resolves reference from libraries to classes and other libraries. /// </summary> /// <param name="libraryTable">The table of known libraries.</param> /// <param name="resolvedLibraryList">The list of libraries that have been resolved so far.</param> /// <param name="importChanged">Indicates that the import specifier has changed.</param> /// <param name="errorList">List of errors found.</param> /// <returns>True if the method succeeded.</returns> public virtual bool Resolve(ISealableDictionary <string, ISealableDictionary <string, ILibrary> > libraryTable, IList <ILibrary> resolvedLibraryList, ref bool importChanged, IErrorList errorList) { List <IImport> ToRemove = new List <IImport>(); bool Success = true; foreach (IImport ImportItem in ImportList) { // Check the import and obtain the matching library. if (!ImportItem.CheckImportConsistency(libraryTable, out ILibrary MatchingLibrary, errorList)) { Success = false; continue; } // You can't import the same library twice. if (ImportedLibraryList.Contains(MatchingLibrary)) { Success = false; errorList.AddError(new ErrorDuplicateImport((IIdentifier)ImportItem.LibraryIdentifier, MatchingLibrary.ValidLibraryName, MatchingLibrary.ValidSourceName)); continue; } // If the imported library hasn't been resolved yet, ignore it for now. if (!resolvedLibraryList.Contains(MatchingLibrary)) { continue; } // The imported library was resolved, merge this import with it. if (!MergeImports(ImportedClassTable, ImportItem, MatchingLibrary, errorList)) { Success = false; continue; } ImportedLibraryList.Add(MatchingLibrary); ToRemove.Add(ImportItem); importChanged = true; } foreach (IImport ImportItem in ToRemove) { ImportList.Remove(ImportItem); } Debug.Assert(Success || !errorList.IsEmpty); return(Success); }
public void ReplaceImports() { if (_riaClientFolderOk) { _tempList = new List <string>(); ImportList.Clear(); NumberOfUpdates = 0; // Process *.cs var files = Directory.GetFiles(_riaClientPath, "*.cs", SearchOption.AllDirectories); // Directory.EnumerateFiles(_riaClientPath, "*.cs"); ProcessFilesForImport(files); // Process *.xaml.cs files = Directory.GetFiles(_riaClientPath, "*.xaml.cs", SearchOption.AllDirectories); //Directory.EnumerateFiles(_riaClientPath, "*.xaml.cs"); ProcessFilesForImport(files); ImportList = new ObservableCollection <string>(_tempList); NumberOfUpdates = _numberOfUpdates; } }
public async Task Import(UserSettings settings) { try { await AuthorizeBot(settings); var result = await _instaApi.GetUserFollowersAsync(settings.TargetUsername, PaginationParameters.Empty); var followers = result.Value; var count = followers.Count; var import = new ImportList() { Date = DateTime.UtcNow, Count = followers.Count, UserId = settings.UserId, TargetName = settings.TargetUsername }; _context.ImportLists.Add(import); await _context.SaveChangesAsync(); foreach (var item in followers) { var follower = new InstaUser() { ImportId = import.Id, IsPrivate = item.IsPrivate, IsVerified = item.IsVerified, FullName = item.FullName, Pk = item.Pk, UserName = item.UserName, ProfilePicture = item.ProfilePicture, ProfilePictureId = item.ProfilePictureId }; _context.InstaUsers.Add(follower); } await _context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } }
public void AddBookToBill() { if (SelectedBook is null) { ShowMessage(new Models.Message("Thông báo", "Chưa chọn sách")); return; } ImportItem item = new ImportItem(SelectedBook, Amount, CoverPrice, ImportPrice); ImportItem check = ImportList.FirstOrDefault(x => x.BookId == item.BookId && x.CoverPrice == item.CoverPrice && x.ImportPrice == item.ImportPrice); if (check is null) { ImportList.Add(item); } else { check.Amount += item.Amount; } TotalBooks += item.Amount; TotalPrice += item.TotalPrice; }
public void TestSerialization() { var import = new ImportList { Groups = { new ImportGroup { Lights = { new ImportLight { Id = 1 }, new ImportLight { Text = "King James Bible" } }, Truths = { new ImportTruth { Text = "Blah{}[]();\",." }, new ImportTruth { Order = 1, Number = 1, Text = "In the beginning God created the heaven and the earth." }, new ImportTruth { Order = 2, Number = 2, Text = "And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters." } } } } }; var json = JsonConvert.SerializeObject(import, Formatting.Indented); Assert.IsFalse(string.IsNullOrEmpty(json)); }
public void visitImportList(ImportList il) { throw new NotImplementedException(); }
public void visitImportList(ImportList il) { visitChildren(il); }
/// <summary> /// Initialize the <see cref="Package"/> by reading from the given filename. /// </summary> /// <param name="state">The <see cref="State"/> this <see cref="Package"/> is to exist within.</param> /// <param name="fileName">The name of the file to open that contains the <see cref="Package"/>.</param> /// <param name="reader">The <see cref="BinaryReader"/> to read from.</param> public Package(State state, string fileName, BinaryReader reader) { if (state == null) throw new ArgumentNullException("state"); if (reader == null) throw new ArgumentNullException("reader"); if (reader.ReadInt32() != Magic) throw new Exception("Unreal package magic test failed."); Reader = reader; FileName = fileName; Export = new Unreal.Export(this, -1); Export.Name = Path.GetFileNameWithoutExtension(fileName); Export.LoadedObject = this; StateValue = state; FileVersion = reader.ReadUInt16(); LicenseMode = reader.ReadUInt16(); Flags = (PackageFlag)reader.ReadUInt32(); var nameCount = reader.ReadInt32(); var nameOffset = reader.ReadUInt32(); var exportCount = reader.ReadInt32(); var exportOffset = reader.ReadUInt32(); var importCount = reader.ReadInt32(); var importOffset = reader.ReadUInt32(); if (FileVersion >= 68) Guid = new Guid(reader.ReadBytes(16)); Imports = new ImportList(importCount); for (var index = 0; index < importCount; index++) Imports.Add(new Import(this, index)); Exports = new ExportList(exportCount); for (var index = 0; index < exportCount; index++) Exports.Add(new Export(this, index)); Names = new NameList(nameCount); reader.BaseStream.Position = nameOffset; for (var index = 0; index < nameCount; index++) Names.Add(new Name(this, reader)); reader.BaseStream.Position = exportOffset; for (var index = 0; index < exportCount; index++) Exports[index].Load(reader); reader.BaseStream.Position = importOffset; for (var index = 0; index < importCount; index++) Imports[index].Load(reader); FilteredExports = new ExportList(exportCount); foreach (var export in Exports) { /*if(export.ObjectClassReference != null && export.ObjectClassReference.Name.EndsWith("Property")) { if(((((Alexandria.Engines.Unreal.Core.Property)export.Object).PropertyFlags) & Alexandria.Engines.Unreal.Core.PropertyFlag.Test) != 0) FilteredExports.Add(export); }*/ if (export.ObjectClassReference == null || !export.ObjectClassReference.Name.EndsWith("Property")) FilteredExports.Add(export); } Game = DetermineGame(FileVersion, LicenseMode, IsEncrypted); }
//public async Task<IQueryable> WeeklyPlanInsert(string filePath, string ProcessId) public List <ImportList> WeeklyPlanInsert(string filePath, string ProcessId) { //Read Excel FileInfo file = new FileInfo(filePath); using (ExcelPackage package = new ExcelPackage(file)) { string PartNo, FCode, SeriesLot; decimal QtyAllLot; var ImpList = new List <ImportList>(); ExcelWorksheet worksheet = package.Workbook.Worksheets[1]; int rowCount = worksheet.Dimension.Rows; int ColCount = worksheet.Dimension.Columns; for (int row = 2; row <= rowCount; row++) { try { if (worksheet.Cells[row, 1].Value != null) { PartNo = worksheet.Cells[row, 1].Value.ToString(); } else { PartNo = ""; } } catch { PartNo = ""; } try { if (worksheet.Cells[row, 2].Value != null) { FCode = worksheet.Cells[row, 2].Value.ToString(); } else { FCode = ""; } } catch { FCode = ""; } try { if (worksheet.Cells[row, 3].Value != null) { QtyAllLot = decimal.Parse(worksheet.Cells[row, 3].Value.ToString()); } else { QtyAllLot = 0; } } catch { QtyAllLot = 0; } try { if (worksheet.Cells[row, 4].Value != null) { SeriesLot = worksheet.Cells[row, 4].Value.ToString(); } else { SeriesLot = ""; } } catch { SeriesLot = ""; } //Add ImportList ImportList t = new ImportList(); t.id = row - 1; t.ProcessID = ProcessId; t.ProcessDate = DateTime.Now; t.FCode = FCode; t.ItemCode = PartNo; t.QtyOrderAll = (int)QtyAllLot; t.SeriesLot = SeriesLot; t.Msg = "Success"; t.Confirm = "No"; ImpList.Add(t); //Add user id var identity = (ClaimsIdentity)User.Identity; IEnumerable <Claim> claims = identity.Claims; var c = claims.FirstOrDefault(); using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.Parameters.Clear(); cmd.CommandText = "m_sp_WeeklyPlan_Insert"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@FCode", SqlDbType.NVarChar) { Value = FCode }); cmd.Parameters.Add(new SqlParameter("@ItemCode", SqlDbType.NVarChar) { Value = PartNo }); cmd.Parameters.Add(new SqlParameter("@QtyOrderAll", SqlDbType.Int) { Value = QtyAllLot }); cmd.Parameters.Add(new SqlParameter("@SeriesLot", SqlDbType.NVarChar) { Value = SeriesLot }); cmd.Parameters.Add(new SqlParameter("@CreateBy", SqlDbType.NVarChar) { Value = c.Value }); cmd.Parameters.Add(new SqlParameter("@PlanUserDef1", SqlDbType.NVarChar) { Value = "" }); cmd.Parameters.Add(new SqlParameter("@PlanUserDef2", SqlDbType.NVarChar) { Value = "" }); cmd.Parameters.Add(new SqlParameter("@ConfirmReplace", SqlDbType.NVarChar) { Value = "N" }); cmd.Parameters.Add(new SqlParameter("@ProcessID", SqlDbType.NVarChar) { Value = ProcessId }); try { if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } //await cmd.ExecuteNonQueryAsync(); cmd.ExecuteNonQuery(); } catch (SqlException ex) { //return ex.Message; throw ex; } } } return(ImpList); } }