public frChonMon(LoadBill loadBill, LoadTable loadTable) { InitializeComponent(); this.StartPosition = FormStartPosition.CenterScreen; this.loadBill = loadBill; this.loadTable = loadTable; }
private void btnUpdateTable_Click(object sender, EventArgs e) { bool result = false; string name = txtTableName.Text.Trim(); int idTable = Convert.ToInt32(txtTableID.Text.Trim()); string status = cbTableStatus.SelectedItem.ToString(); bool existed = TableDAO.Instance.IsExistedTable(name); if (txtTableName.Text.Equals("")) { MessageBox.Show("Empty input."); return; } if (MessageBox.Show(string.Format("Update this TableID: {0}?", idTable), "Notification!!!", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { result = TableDAO.Instance.UpdateTable(name, status, idTable); if (result) { MessageBox.Show("Update Successfully!"); LoadListTable(); LoadTable.Invoke(); } else { MessageBox.Show("Update failed!"); } } }
private void btnAddTable_Click(object sender, EventArgs e) { bool result = false; string name = txtTableName.Text.Trim(); int idTable = Convert.ToInt32(txtTableID.Text.Trim()); string status = cbTableStatus.SelectedItem.ToString(); bool existed = TableDAO.Instance.IsExistedTable(name); if (txtTableName.Text.Equals("")) { MessageBox.Show("Empty input."); return; } if (existed) { MessageBox.Show("This table: " + name + " is existed."); return; } result = TableDAO.Instance.AddTable(name); if (result) { MessageBox.Show("Add Successfully!"); LoadListTable(); LoadTable.Invoke(); } else { MessageBox.Show("Add failed!"); } }
private void LoadButton_Click(object sender, EventArgs e) { var OFD = new OpenFileDialog(); OFD.InitialDirectory = DataBase.table.SubTable.SavePath; OFD.Title = String.Concat("Загрузка данных из таблиц"); if (OFD.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } var path = OFD.FileName.Substring(0, OFD.FileName.Length - Path.GetFileName(OFD.FileName).Length); var Tables = new LoadTable[data.T1.Tables.Count]; for (int i = 0; i < data.T1.Tables.Count; i++) { var SubTable = data.T1.Tables[i].CreateSubTable(false); if (SubTable.Parent.RemoteType != DataBase.RemoteType.Local) { if (File.Exists(path + SubTable.Parent.Name + ".xls")) { Tables[i] = new LoadTable(SubTable, path + SubTable.Parent.Name + ".xls"); } else if (File.Exists(path + SubTable.Parent.Name + ".xlsx")) { Tables[i] = new LoadTable(SubTable, path + SubTable.Parent.Name + ".xlsx"); } else { MessageBox.Show("Файл " + path + SubTable.Parent.Name + ".xls/.xlsx не существует"); return; } } } for (int i = 0; i < data.T1.Tables.Count; i++) { if (Tables[i].Table != null) { try { Tables[i].Table.Rows.LoadFromFile(Tables[i].FileName, false, true); } catch (Exception) { MessageBox.Show("Ошибка чтения файла (проверьте не открыт ли файл)"); } } } }
private void btnRestoreTable_Click(object sender, EventArgs e) { int idTable = Convert.ToInt32(txtTableID.Text.Trim()); bool result = false; result = TableDAO.Instance.RestoreTable(idTable); if (result) { MessageBox.Show("Restore Successfully!"); LoadListTableDeleted(); LoadTable.Invoke(); } else { MessageBox.Show("Restore failed!"); } }
public StagingColumn Clone(LoadTable cloneLoadTable, ObservableCollection <Satellite> cloneSatellites) { if (cloneLoadTable == null) { throw new ArgumentNullException(nameof(cloneLoadTable)); } StagingColumn cloneColumn = new(Name) { AddedOnBusinessDate = AddedOnBusinessDate, DataType = DataType, Length = Length, Precision = Precision, Scale = Scale, Nullable = Nullable, Driving = Driving, Logic = Logic }; if (Satellite != null) { Satellite cloneSatellite = cloneSatellites.Single(cloneSatellite => cloneSatellite.Name == Satellite.Name); cloneSatellite.Type = Satellite.Type; cloneColumn.Satellite = cloneSatellite; } if (LoadColumn != null) { cloneColumn.LoadColumn = cloneLoadTable.Columns.Single(loadCol => loadCol.Name == LoadColumn.Name); } if (ExtendedProperties != null && ExtendedProperties.Count > 0) { cloneColumn.ExtendedProperties = new Dictionary <string, string>(); foreach (KeyValuePair <string, string> extendedProperty in ExtendedProperties) { cloneColumn.ExtendedProperties.Add(extendedProperty.Key, extendedProperty.Value); } } return(cloneColumn); }
public new void UpdateTables(Dictionary <string, Column> suggestedColumnDict) { if (suggestedColumnDict == null) { throw new ArgumentNullException(nameof(suggestedColumnDict)); } if (LoadTable == null) { LoadTable = new LoadTable(); } if (StagingTable == null) { StagingTable = new StagingTable(); } // Update existing columns foreach (Column stagingColumn in StagingTable.Columns !) { if (!string.IsNullOrEmpty(stagingColumn.Name) && suggestedColumnDict.ContainsKey(stagingColumn.Name !)) { StagingColumn suggestedColumn = (StagingColumn)suggestedColumnDict[stagingColumn.Name !];
private void btnDeleteTable_Click(object sender, EventArgs e) { bool result = false; int idTable = Convert.ToInt32(txtTableID.Text.Trim()); int idBill = BillDAO.Instance.GetUncheckBillIDByTableID(idTable); if (MessageBox.Show(string.Format("Delete this TableID: {0}?", idTable), "Notification!!!", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { BillInfoDAO.Instance.DeleteBillInfoByBillID(idBill); BillDAO.Instance.DeleteBillByTableID(idTable); result = TableDAO.Instance.DeleteTable(idTable); if (result) { MessageBox.Show("Delete Successfully!"); LoadListTable(); LoadTable.Invoke(); } else { MessageBox.Show("Delete failed!"); } } }
private void btnDeleteCate_Click(object sender, EventArgs e) { bool result = false; int idCate = Convert.ToInt32(txtCategoryID.Text.Trim()); if (MessageBox.Show(string.Format("Delete this CategoryID: {0}?", idCate), "Notification!!!", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { result = CategoryDAO.Instance.DeleteCategory(idCate); if (result) { MessageBox.Show("Delete Successfully!"); LoadListCategory(); LoadCategoryBinding(cbFoodCategory); LoadListFood(); ReLoadCategory.Invoke(); LoadTable.Invoke(); } else { MessageBox.Show("Delete failed!"); } } }
public override DataSource Clone() { GraphQlDataSource clone = new(string.Empty, Connection, SourceSystem, Tenant) { LoadTable = new LoadTable() }; if (LoadTable != null) { foreach (Column column in LoadTable.Columns) { Column cloneColumn = new(column.Name) { AddedOnBusinessDate = column.AddedOnBusinessDate, DataType = column.DataType, Length = column.Length, Precision = column.Precision, Scale = column.Scale, Nullable = column.Nullable }; cloneColumn.PropertyChanged += (s, e) => { NotifyPropertyChanged("Column"); }; clone.LoadTable.Columns.Add(cloneColumn); } } foreach (Satellite sat in Satellites) { Satellite cloneSat = new(sat.Name) { Type = sat.Type }; clone.Satellites.Add(cloneSat); } clone.StagingTable = new StagingTable(); if (StagingTable != null) { foreach (StagingColumn stagingColumn in StagingTable.Columns) { StagingColumn cloneColumn = stagingColumn.Clone(clone.LoadTable, clone.Satellites); stagingColumn.PropertyChanged += (s, e) => { NotifyPropertyChanged("StagingColumn"); }; clone.StagingTable.Columns.Add(cloneColumn); } } if (BusinessKey != null) { if (BusinessKey is Link linkBusinessKey) { Link cloneBusinessKey = new(linkBusinessKey.Name); foreach (StagingColumn stagingColumn in linkBusinessKey.BusinessKeys) { StagingColumn cloneColumn = stagingColumn.Clone(clone.LoadTable, clone.Satellites); cloneBusinessKey.BusinessKeys.Add(cloneColumn); } clone.BusinessKey = cloneBusinessKey; } else if (BusinessKey is Hub hubBusinessKey) { Hub cloneBusinessKey = new(hubBusinessKey.Name); foreach (StagingColumn stagingColumn in hubBusinessKey.BusinessKeys) { StagingColumn cloneColumn = stagingColumn.Clone(clone.LoadTable, clone.Satellites); cloneBusinessKey.BusinessKeys.Add(cloneColumn); } clone.BusinessKey = cloneBusinessKey; } } foreach (HubRelationship hubRelationship in HubRelationships) { Hub cloneHub = new(hubRelationship.Hub.Name); foreach (StagingColumn stagingColumn in hubRelationship.Hub.BusinessKeys) { StagingColumn cloneColumn = stagingColumn.Clone(clone.LoadTable, clone.Satellites); cloneHub.BusinessKeys.Add(cloneColumn); } HubRelationship cloneRelationship = new(cloneHub); foreach (HubMapping hubMapping in hubRelationship.Mappings) { StagingColumn cloneBusinessKeyColumn = clone.BusinessKey !.BusinessKeys.Single(cloneBk => cloneBk.Name == hubMapping.HubColumn.Name); StagingColumn cloneStagingColumn = clone.StagingTable.Columns.Single(cloneStgCol => cloneStgCol.Name == hubMapping.StagingColumn !.Name); HubMapping cloneMapping = new(cloneBusinessKeyColumn) { StagingColumn = cloneStagingColumn }; cloneRelationship.Mappings.Add(cloneMapping); } clone.HubRelationships.Add(cloneRelationship); } foreach (LinkRelationship linkRelationship in LinkRelationships) { Link cloneLink = new(linkRelationship.Link.Name); foreach (StagingColumn stagingColumn in linkRelationship.Link.BusinessKeys) { StagingColumn cloneColumn = stagingColumn.Clone(clone.LoadTable, clone.Satellites); cloneLink.BusinessKeys.Add(cloneColumn); } LinkRelationship cloneRelationship = new(cloneLink); foreach (LinkMapping linkMapping in linkRelationship.Mappings) { StagingColumn cloneBusinessKeyColumn = clone.BusinessKey !.BusinessKeys.Single(cloneBk => cloneBk.Name == linkMapping.LinkColumn.Name); StagingColumn cloneStagingColumn = clone.StagingTable.Columns.Single(cloneStgCol => cloneStgCol.Name == linkMapping.StagingColumn !.Name); LinkMapping cloneMapping = new(cloneBusinessKeyColumn) { StagingColumn = cloneStagingColumn }; cloneRelationship.Mappings.Add(cloneMapping); } clone.LinkRelationships.Add(cloneRelationship); } clone.AzureLinkedServiceReference = AzureLinkedServiceReference; clone.Build = Build; clone.BusinessDateColumn = BusinessDateColumn; clone.CollectionReference = CollectionReference; clone.ContainsMultiStructuredJson = ContainsMultiStructuredJson; clone.DataSourceType = DataSourceType; clone.DefaultLoadWidth = DefaultLoadWidth; clone.ErrorHandling = ErrorHandling; clone.FileName = FileName; clone.IncrementalStagingColumn = IncrementalStagingColumn; clone.IncrementalQuery = IncrementalQuery; clone.MergeToBlob = MergeToBlob; clone.DestinationEncoding = DestinationEncoding; clone.QualifiedName = QualifiedName; clone.GraphQlQuery = GraphQlQuery; clone.NumberToFetch = NumberToFetch; clone.Parent = Parent; clone.RelativeUrl = RelativeUrl; clone.SqlSelectQuery = SqlSelectQuery; clone.GenerateLatestViews = GenerateLatestViews; return(clone); }
public override DataSource Clone() { SqlDataSource clone = new(string.Empty, Connection, SourceSystem, Tenant) { LoadTable = new LoadTable() }; if (LoadTable != null) { foreach (Column column in LoadTable.Columns) { Column cloneColumn = new(column.Name) { DataType = column.DataType, Length = column.Length, Precision = column.Precision, Scale = column.Scale, Nullable = column.Nullable }; cloneColumn.PropertyChanged += (s, e) => { NotifyPropertyChanged("Column"); }; clone.LoadTable !.Columns.Add(cloneColumn); } } foreach (Satellite sat in Satellites) { Satellite cloneSat = new(sat.Name) { Type = sat.Type }; clone.Satellites.Add(cloneSat); } clone.StagingTable = new StagingTable(); if (StagingTable != null) { foreach (StagingColumn stagingColumn in StagingTable.Columns) { StagingColumn cloneColumn = stagingColumn.Clone(clone.LoadTable !, clone.Satellites); stagingColumn.PropertyChanged += (s, e) => { NotifyPropertyChanged("StagingColumn"); }; clone.StagingTable.Columns.Add(cloneColumn); } } if (BusinessKey != null) { if (BusinessKey is Link link) { clone.BusinessKey = link; } else if (BusinessKey is Hub hub) { clone.BusinessKey = hub; } } foreach (HubRelationship hubRelationship in HubRelationships) { Hub hub = hubRelationship.Hub; HubRelationship cloneRelationship = new(hub); foreach (HubMapping hubMapping in hubRelationship.Mappings) { StagingColumn cloneStagingColumn = clone.StagingTable.Columns.Single(cloneStgCol => cloneStgCol.Name == hubMapping.StagingColumn !.Name); HubMapping cloneMapping = new(hubMapping.HubColumn) { StagingColumn = cloneStagingColumn }; cloneRelationship.Mappings.Add(cloneMapping); } clone.HubRelationships.Add(cloneRelationship); } foreach (LinkRelationship linkRelationship in LinkRelationships) { Link cloneLink = linkRelationship.Link; LinkRelationship cloneRelationship = new(cloneLink); foreach (LinkMapping linkMapping in linkRelationship.Mappings) { StagingColumn cloneStagingColumn = clone.StagingTable.Columns.Single(cloneStgCol => cloneStgCol.Name == linkMapping.StagingColumn !.Name); LinkMapping cloneMapping = new(linkMapping.LinkColumn) { StagingColumn = cloneStagingColumn }; cloneRelationship.Mappings.Add(cloneMapping); } clone.LinkRelationships.Add(cloneRelationship); } clone.AzureLinkedServiceReference = AzureLinkedServiceReference; clone.Build = Build; clone.BusinessDateColumn = BusinessDateColumn; clone.ContainsMultiStructuredJson = ContainsMultiStructuredJson; clone.DataSourceType = DataSourceType; clone.DefaultLoadWidth = DefaultLoadWidth; clone.ErrorHandling = ErrorHandling; clone.FileName = FileName; clone.IncrementalStagingColumn = IncrementalStagingColumn; clone.IncrementalQuery = IncrementalQuery; clone.QualifiedName = QualifiedName; clone.SqlSelectQuery = SqlSelectQuery; clone.SqlStatement = SqlStatement; clone.ConnectionRetryAttempts = ConnectionRetryAttempts; clone.ConnectionRetryMinutes = ConnectionRetryMinutes; clone.GenerateLatestViews = GenerateLatestViews; return(clone); }
public frChuyenBan(LoadTable loadTable) { InitializeComponent(); this.loadTable = loadTable; }