/// <summary> /// Get import files /// </summary> public static List<CTImportList> GetImportLists() { List<CTImportList> _items = null; using (BrightPlatformEntities _objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection)) { _objBrightPlatformEntity.CommandTimeout = 0; _items = _objBrightPlatformEntity.FIGetImportLists().ToList(); } return _items; //m_objBrightPlatformEntity.CommandTimeout = 0; //var objImportLists = // from objImportList in m_objBrightPlatformEntity.imported_files // join objCustomer in m_objBrightPlatformEntity.customers on objImportList.customer_id equals objCustomer.id // join objUser in m_objBrightPlatformEntity.users on objImportList.created_by equals objUser.id // join objCampaign in m_objBrightPlatformEntity.campaigns on objImportList.campaign_id equals objCampaign.id // join objTCountry in m_objBrightPlatformEntity.countries on objImportList.country_id equals objTCountry.id into objTCountry // from objCountry in objTCountry.DefaultIfEmpty() // orderby objImportList.active descending, objImportList.id descending // select new ImportListInstance // { // id = objImportList.id, // active = (objImportList.active == null? false: (bool) objImportList.active), // profiled = (objImportList.profiled == null? false: (bool) objImportList.profiled), // matched_by_account = (objImportList.matched_by_account == null? false: (bool) objImportList.matched_by_account), // matched_by_contact = (objImportList.matched_by_contact == null? false: (bool) objImportList.matched_by_contact), // improved_master_data = (objImportList.improved_master_data == null? false: (bool) objImportList.improved_master_data), // country = "", // import_list_name = objImportList.list_name, // date_and_time = (DateTime) objImportList.created_date, // customer_name = objCustomer.customer_name, // imported_by = objUser.fullname, // customer_id = objCustomer.id, // campaign_id = objImportList.campaign_id, // campaign_name = objCampaign.campaign_name, // country_id = objImportList.country_id == null? 0: (int) objImportList.country_id, // country_name = objCountry.name, // source_file_name = objImportList.source_file_name // }; ////m_objBrightPlatformEntity.Connection.Close(); //return objImportLists.ToList(); }
public void PopulateImportListView(int ImportFileId = 0) { if (Convert.ToInt32(tbxMaxRow.Text) < 1) { NotificationDialog.Warning("Bright Sales", "Invalid max row setting."); return; } try { if (ImportFileId > 0) m_SelectedImportFileId = ImportFileId; m_IsLoading = true; lblImportFileTotalRecords.Text = "Total Records: 0"; using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection) { CommandTimeout = 0 }) { gcImportRecord.BeginUpdate(); gcImportFile.BeginUpdate(); gcImportRecord.DataSource = null; gcImportFile.DataSource = null; gcImportFile.DataSource = _efDbContext.FIGetImportLists(Convert.ToInt32(tbxMaxRow.Text)).ToList(); gvImportFile.BestFitColumns(); gcImportRecord.EndUpdate(); gcImportFile.EndUpdate(); } //gcImportFile.DataSource = DataImportUtility.GetImportLists(); //lblImportFileTotalRecords.Text = "Total Records: " + gvImportFile.RowCount.ToString(); //gvImportFile.BestFitColumns(); this.SetDefaultSelectedRow(); m_IsLoading = false; } catch (Exception ex) { MessageBox.Show("Error: " + ex.InnerException.Message, "Bright Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); } }