public static string Difference(DataProvider from, DataProvider to, string dbNameFrom, string dbNameTo) { DatabaseName dname1 = new DatabaseName(from, dbNameFrom); DatabaseName dname2 = new DatabaseName(to, dbNameTo); string[] names = MetaDatabase.GetTableNames(dname1); StringBuilder builder = new StringBuilder(); foreach (string tableName in names) { TableName tname1 = new TableName(dname1, tableName); TableName tname2 = new TableName(dname2, tableName); string[] primaryKeys = InformationSchema.PrimaryKeySchema(tname1).ToArray<string>(0); if (primaryKeys.Length == 0) continue; if (MetaDatabase.TableExists(tname2)) { builder.Append(TableCompare.Difference(tname1, tname2, tableName, primaryKeys)); } else { builder.Append(TableCompare.Rows(tableName, from)); } builder.AppendLine(); } return builder.ToString(); }
public MatchReferencePredicate(DataProvider provider, Type entityType, string propertyName, Type referencedEntityType, Guid referencedEntityID, string mirrorPropertyName) { ReferencedEntityID = referencedEntityID; PropertyName = propertyName; ReferencedEntityType = referencedEntityType; MirrorPropertyName = mirrorPropertyName; }
public static DbConnectionStringBuilder CreateConnectionStringBuilder(DataProvider dataProvider) { DbConnectionStringBuilder dbConnectionStringBuilder; switch (dataProvider) { case DataProvider.Odbc: dbConnectionStringBuilder = new OdbcConnectionStringBuilder(); break; case DataProvider.OleDB: dbConnectionStringBuilder = new OleDbConnectionStringBuilder(); break; case DataProvider.SqlServer: dbConnectionStringBuilder = new SqlConnectionStringBuilder(); break; default: dbConnectionStringBuilder = null; break; } return dbConnectionStringBuilder; }
public static DbConnection CreateConnection(DataProvider dataProvider) { DbConnection dbConnection; switch (dataProvider) { case DataProvider.Odbc: dbConnection = new OdbcConnection(); break; case DataProvider.OleDB: dbConnection = new OleDbConnection(); break; case DataProvider.SqlServer: dbConnection = new SqlConnection(); break; default: dbConnection = null; break; } return dbConnection; }
public MyConnectionSql(DataProvider dataProvider) : base(dataProvider) { SqlConnection conn = new SqlConnection(@"server = .\sqlexpress; integrated security = true;"); try { // Abrir la conexión conn.Open(); // Detalles de la conexión this.DetallesConexion(conn); } catch (SqlException ex) { // Desplegar la excepción e el error Console.WriteLine("Error: " + ex.Message + ex.StackTrace); } finally { // Cerrar la conexión conn.Close(); Console.WriteLine("Conexión cerrada."); } }
protected override DataSet CreateDataSet(DataProvider dataProvider) { var filter = GetFilter<DepartmentsReportFilter>(); var databaseService = new RubezhDAL.DataClasses.DbService(); dataProvider.LoadCache(); var departments = GetDepartments(dataProvider, filter); var uids = departments.Select(item => item.UID).ToList(); var employees = dataProvider.GetEmployees(departments.Where(item => item.Item.ChiefUID != Guid.Empty).Select(item => item.Item.ChiefUID)); var ds = new DepartmentsDataSet(); departments.ForEach(department => { var row = ds.Data.NewDataRow(); row.Organisation = department.Organisation; row.Department = department.Name; row.Phone = department.Item.Phone; row.Chief = employees.Where(item => item.UID == department.Item.ChiefUID).Select(item => item.Name).FirstOrDefault(); row.ParentDepartment = dataProvider.Departments.ContainsKey(department.Item.ParentDepartmentUID) ? dataProvider.Departments[department.Item.ParentDepartmentUID].Name : string.Empty; row.Description = department.Item.Description; row.IsArchive = department.IsDeleted; var parents = GetParents(dataProvider, department); row.Level = parents.Count; row.Tag = string.Join("/", parents.Select(item => item.UID)); ds.Data.AddDataRow(row); }); return ds; }
/// <summary> /// Tạo id - khóa chính /// </summary> /// <param name="strFormat">Chuỗi định dạng</param> /// <param name="pTable">Bảng muốn tạo khóa chính</param> /// <returns>Khóa chính</returns> public string CreateId(string strFormat, string pTable) { string id; DataProvider dp = new DataProvider(); DataTable dt = new DataTable(); dt = GetAll(pTable); int rowCount = dt.Rows.Count + 1; string row; if (rowCount < 10) { row = "000" + rowCount.ToString(); } else if (rowCount >= 10 && rowCount < 100) { row = "00" + rowCount.ToString(); } else if (rowCount >= 100 && rowCount < 1000) { row = "0" + rowCount.ToString(); } else row = rowCount.ToString(); id = strFormat.ToString() + row.ToString(); return id; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); dataProvider = new DataProvider(XDocument.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("Lines.xml")), XDocument.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("Stations.xml")), XDocument.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("StationLines.xml"))); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); spinnerLine = FindViewById<Spinner>(Resource.Id.spinnerLine); spinnerStationFrom = FindViewById<Spinner>(Resource.Id.spinnerStationFrom); spinnerStationTo = FindViewById<Spinner>(Resource.Id.spinnerStationTo); Button buttonSwap = FindViewById<Button>(Resource.Id.buttonSwap); buttonSwap.Click += new EventHandler(swapDirection); Button buttonSave = FindViewById<Button>(Resource.Id.buttonSave); buttonSave.Click += new EventHandler(SaveSettings); Button buttonSearch = FindViewById<Button>(Resource.Id.buttonSearch); buttonSearch.Click += new EventHandler(lookup); SetUpLine(); SetUpStationFrom(); SetUpStationTo(); }
private void textBox1_TextChanged(object sender, System.EventArgs e) { using (var dataProvider = new DataProvider()) { } }
public ActionResult Index(string id, string priceOrder) { if (string.IsNullOrEmpty(id)) id = _userInfo.LastSelectedCategory; else _userInfo.LastSelectedCategory = id; var dataProvider = new DataProvider(); var selectors = dataProvider.GetSelectors(); ViewBag.CategorySelectors = selectors[0]; ViewBag.EventSelectors = selectors[1]; var bouquetes = dataProvider.GetBouquetsByCategory(id); if (!string.IsNullOrEmpty(priceOrder)) { if (priceOrder.ToLower() == "lacne") bouquetes = bouquetes.OrderBy(_ => _.Sizes.Min(size => size.Price)).ToList(); else if (priceOrder.ToLower() == "drahe") bouquetes = bouquetes.OrderByDescending(_ => _.Sizes.Max(size => size.Price)).ToList(); } ViewBag.Bouquetes = bouquetes; ViewBag.CurrentCategory = id; ViewBag.CurrentOrder = priceOrder; return View(); }
public static DbCommand CreateCommand(DataProvider dataProvider) { DbCommand dbCommand; switch (dataProvider) { case DataProvider.Odbc: dbCommand = new OdbcCommand(); break; case DataProvider.OleDB: dbCommand = new OleDbCommand(); break; case DataProvider.SqlServer: dbCommand = new SqlCommand(); break; default: dbCommand = null; break; } return dbCommand; }
// Called before the action in the inherited controller is executed, allowing certain members to be set protected override void OnActionExecuting(ActionExecutingContext ctx) { base.OnActionExecuting(ctx); this.db = HengeApplication.DataProvider; this.globals = HengeApplication.Globals; // If the user has logged in then add their name to the view data if (this.User.Identity.IsAuthenticated) { this.user = this.db.Get<User>(x => x.Name == this.User.Identity.Name); this.avatar = Session["Avatar"] as Avatar; if(this.avatar != null && this.avatar.User != this.user) { this.avatar = null; } this.cache = Session["Cache"] as Cache; this.ViewData["User"] = this.User.Identity.Name; this.ViewData["Character"] = (this.avatar != null) ? string.Format("{0} of {1}", this.avatar.Name, this.user.Clan) : null; } else { this.user = null; this.avatar = null; } }
private static IEnumerable<OrganisationBaseObjectInfo<Position>> GetPosition(DataProvider dataProvider, PositionsReportFilter filter) { var organisationUID = Guid.Empty; var organisations = dataProvider.Organisations.Where(org => filter.User == null || filter.User.IsAdm || org.Value.Item.UserUIDs.Any(y => y == filter.User.UID)); if (filter.Organisations.IsEmpty()) { if (filter.IsDefault) organisationUID = organisations.FirstOrDefault().Key; } else { organisationUID = organisations.FirstOrDefault(org => org.Key == filter.Organisations.FirstOrDefault()).Key; } IEnumerable<OrganisationBaseObjectInfo<Position>> positions = null; if (organisationUID != Guid.Empty) { positions = dataProvider.Positions.Values.Where(item => item.OrganisationUID == organisationUID); if (!filter.UseArchive) positions = positions.Where(item => !item.IsDeleted); if (!filter.Positions.IsEmpty()) positions = positions.Where(item => filter.Positions.Contains(item.UID)); } return positions != null ? positions : new List<OrganisationBaseObjectInfo<Position>>(); }
public MyConnectionOdbc(DataProvider dataProvider) : base(dataProvider) { // Crear conexión OdbcConnection conn = new OdbcConnection(@"provider = sqlodbc; data source = .\sqlexpress; trusted connection = yes;"); try { // Abrir conexión conn.Open(); Console.WriteLine("Conexión establecida."); // Detalles de la conexión this.DetallesConexion(conn); } catch (OdbcException ex) { // Desplegar excepción o error Console.WriteLine("Error: " + ex.Message + ex.StackTrace); } finally { //Cerrar la conexión conn.Close(); } }
public static IDbTransaction GetTransaction(DataProvider providerType, IDbConnection connection) { IDbConnection iDbConnection = null; IDbTransaction iDbTransaction = null; try { iDbConnection = connection; if (iDbConnection != null) { if (iDbConnection.State != ConnectionState.Open) iDbConnection.Open(); iDbTransaction = iDbConnection.BeginTransaction(); } } catch (Exception ex) { iDbConnection = null; iDbTransaction = null; throw ex; } return iDbTransaction; }
public ActionResult Index() { var provider = new DataProvider(); ViewBag.Actions = provider.GetCurrentAcions(); ViewBag.HotPropositions = provider.GetHotPropositions(); return View(); }
public static IDbCommand GetCommand(string sql, CommandType cmdType, int timeout , DbParameter[] parameters, DataProvider provider) { IDbCommand command = GetCommand(provider); if (parameters != null) { for (int index = 0; index < parameters.Length; index++) { DbParameter parameter = parameters[index]; if (parameter == null) continue; IDbDataParameter param = GetParameter(parameter.Name , parameter.Direction , parameter.Value , parameter.DataType , parameter.SourceColumn , (short)parameter.Size, provider); command.Parameters.Add(param); } } command.CommandType = cmdType; command.CommandText = sql; command.CommandTimeout = timeout; return command; }
private void AddRecord(DataProvider dataProvider, EmployeeZonesDataSet ds, RubezhDAL.DataClasses.PassJournal record, EmployeeZonesReportFilter filter, bool isEnter, Dictionary<Guid, string> zoneMap) { if (record.EmployeeUID == null) return; var dataRow = ds.Data.NewDataRow(); var employee = dataProvider.GetEmployee(record.EmployeeUID.Value); dataRow.Employee = employee.Name; dataRow.Orgnisation = employee.Organisation; dataRow.Department = employee.Department; dataRow.Position = employee.Position; dataRow.Zone = zoneMap.ContainsKey(record.ZoneUID) ? zoneMap[record.ZoneUID] : null; dataRow.EnterDateTime = record.EnterTime; if (record.ExitTime.HasValue) { dataRow.ExitDateTime = record.ExitTime.Value; dataRow.Period = dataRow.ExitDateTime - dataRow.EnterDateTime; } else { dataRow.ExitDateTime = filter.ReportDateTime; dataRow.Period = filter.ReportDateTime - dataRow.EnterDateTime; } if (!filter.IsEmployee) { var escortUID = employee.Item.EscortUID; if (escortUID.HasValue) { var escort = dataProvider.GetEmployee(escortUID.Value); dataRow.Escort = escort.Name; } } ds.Data.Rows.Add(dataRow); }
public MyConnectionOleDb(DataProvider dataProvider) : base(dataProvider) { // Crear conexión OleDbConnection conn = new OleDbConnection(@"provider = sqloledb; data source = .\sqlexpress; integrated security = sspi;"); try { // Abrir conexión conn.Open(); Console.WriteLine("Conexión establecida."); // Detalles de la conexión this.DetallesConexion(conn); } catch (OleDbException ex) { // Desplegar excepción o error Console.WriteLine("Error: " + ex.Message + ex.StackTrace); } finally { //Cerrar la conexión conn.Close(); } }
public LightSpeedInstallerRepository(DataProvider dataProvider, SchemaBase schema, string connectionString) { DataProvider = dataProvider; Schema = schema; ConnectionString = connectionString; _context = CreateLightSpeedContext(dataProvider, connectionString); }
protected void Page_Load(object sender, EventArgs e) { dataProvider = new DataProvider(XDocument.Load("../WebScraper/Lines.xml"), XDocument.Load("../WebScraper/Stations.xml"), XDocument.Load("../WebScraper/StationLines.xml")); SetUpLine(); SetUpStationFrom(); SetUpStationTo(); }
protected void Page_Load(object sender, EventArgs e) { dataProvider = new DataProvider(XDocument.Load("http://trainstrains.blob.core.windows.net/xml/Lines.xml"), XDocument.Load("http://trainstrains.blob.core.windows.net/xml/Stations.xml"), XDocument.Load("http://trainstrains.blob.core.windows.net/xml/StationLines.xml")); lineSelection.Value = Request.Form ["DropDownListLines"]; fromSelection.Value = Request.Form ["DropDownListFrom"]; toSelection.Value = Request.Form ["DropDownListTo"]; }
public ActionResult Add(int id, int count = 1) { var dataProvider = new DataProvider(); var b = dataProvider.GetBouquetByConcreteId(id); b.Count = count; _order.Bouquetes.Add(b); Response.Redirect("~/Kosik"); return View("Index"); }
protected void ListUserInRole_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete" && ListUser.SelectedValue != null) { DataProvider dp = new DataProvider(); string roleName = e.CommandArgument.ToString(); dp.DeleteUsersFromRoles(ListUser.SelectedValue.ToString(), roleName); } }
public DataAccess(DataProvider dataProvider, string connectionString) { if (!Enum.IsDefined(typeof(DataProvider), dataProvider)) throw new ArgumentException(Resources.DataAccessInvalidDataProvider, "dataProvider"); this.dataProvider = dataProvider; this.dbConnectionStringBuilder = DataAccessBuilder.CreateConnectionStringBuilder(dataProvider); this.dbConnectionStringBuilder.ConnectionString = connectionString; }
public DataStoreType(string name, string description, DataProvider lightSpeedDbType, SchemaBase schema) { Name = name; Description = description; RequiresCustomRepository = false; CustomRepositoryType = ""; LightSpeedDbType = lightSpeedDbType; Schema = schema; }
public ActionResult ChangeSize(Guid id, int count) { var dataProvider = new DataProvider(); var b = dataProvider.GetBouquetByConcreteId(count); b.Count = _order.Bouquetes.First(_=>_.OrderItemId == id).Count; _order.Bouquetes.Remove(_order.Bouquetes.First(_ => _.OrderItemId == id)); _order.Bouquetes.Add(b); Response.Redirect("~/Kosik"); return View("Index"); }
public OperateContext(string identifier , DatabaseType dbType, DataProvider provider, string connString) { if (string.IsNullOrEmpty(identifier)) throw new ArgumentNullException("identifier"); this.m_identifier = identifier; this.m_dbType = dbType; this.m_provider = provider; this.m_connString = connString; }
protected override DataSet CreateDataSet(DataProvider dataProvider) { var filter = GetFilter<CardsReportFilter>(); var cardFilter = new CardFilter(); cardFilter.EmployeeFilter = dataProvider.GetCardEmployeeFilter(filter); if ((filter.PassCardActive && filter.PassCardInactive) || (!filter.PassCardActive && !filter.PassCardInactive)) cardFilter.DeactivationType = LogicalDeletationType.All; if (filter.PassCardActive && !filter.PassCardInactive) cardFilter.DeactivationType = LogicalDeletationType.Active; if (!filter.PassCardActive && filter.PassCardInactive) cardFilter.DeactivationType = LogicalDeletationType.Deleted; cardFilter.IsWithEndDate = filter.UseExpirationDate; if (filter.UseExpirationDate) switch (filter.ExpirationType) { case EndDateType.Day: cardFilter.EndDate = DateTime.Today.AddDays(1); break; case EndDateType.Week: cardFilter.EndDate = DateTime.Today.AddDays(7); break; case EndDateType.Month: cardFilter.EndDate = DateTime.Today.AddDays(31); break; case EndDateType.Arbitrary: cardFilter.EndDate = filter.ExpirationDate; break; } var cardsResult = dataProvider.DbService.CardTranslator.Get(cardFilter); var dataSet = new CardsDataSet(); if (!cardsResult.HasError) { dataProvider.GetEmployees(cardsResult.Result.Select(item => item.EmployeeUID.GetValueOrDefault())); foreach (var card in cardsResult.Result) { var dataRow = dataSet.Data.NewDataRow(); dataRow.Type = card.IsInStopList ? "Деактивированный" : card.GKCardType.ToDescription(); dataRow.Number = card.Number.ToString(); var employee = dataProvider.GetEmployee(card.EmployeeUID.GetValueOrDefault()); if (employee != null) { dataRow.Employee = employee.Name; dataRow.Organisation = employee.Organisation; dataRow.Department = employee.Department; dataRow.Position = employee.Position; } if (!card.IsInStopList) dataRow.Period = card.EndDate; dataSet.Data.Rows.Add(dataRow); } } return dataSet; }
/// <summary> /// Creates main window /// </summary> /// <returns>Main window</returns> public static MainWindow GetMainWindow() { IDataAccessLayer dataAccessLayer = new DataAccessLayer(); IMapper mapper = new Mapper(); IDataProvider dataProvider = new DataProvider(dataAccessLayer, mapper); IInferenceLogger inferenceLogger = new InferenceLogger(); IInferenceModule inferenceModule = new InferenceModule(dataProvider, inferenceLogger); IPresenter presenter = new Presenter(inferenceModule, dataAccessLayer); MainWindow mainWindow = new MainWindow(presenter); return mainWindow; }
/// <summary> /// AddIndexWords adds the Index Words to the Data Store /// </summary> /// <param name="indexId">The Id of the SearchItem</param> /// <param name="searchItem">The SearchItem</param> /// <param name="language">The Language of the current Item</param> /// <history> /// [cnurse] 11/15/2004 documented /// [cnurse] 11/16/2004 replaced calls to separate content clean-up /// functions with new call to HtmlUtils.Clean(). /// replaced logic to determine whether word should /// be indexed by call to CanIndexWord() /// </history> private void AddIndexWords(int indexId, SearchItemInfo searchItem, string language) { Hashtable IndexWords = new Hashtable(); Hashtable IndexPositions = new Hashtable(); //Get the Settings for this Module _settings = SearchDataStoreController.GetSearchSettings(searchItem.ModuleId); if (_settings == null) { //Try Host Settings _settings = Globals.HostSettings; } string setting = GetSetting("MaxSearchWordLength"); if (!String.IsNullOrEmpty(setting)) { maxWordLength = int.Parse(setting); } setting = GetSetting("MinSearchWordLength"); if (!String.IsNullOrEmpty(setting)) { minWordLength = int.Parse(setting); } setting = GetSetting("SearchIncludeCommon"); if (setting == "Y") { includeCommon = true; } setting = GetSetting("SearchIncludeNumeric"); if (setting == "N") { includeNumbers = false; } string Content = searchItem.Content; // clean content Content = HtmlUtils.Clean(Content, true); Content = Content.ToLower(); //' split content into words string[] ContentWords = Content.Split(' '); // process each word int intWord = 0; string strWord; foreach (string tempLoopVar_strWord in ContentWords) { strWord = tempLoopVar_strWord; if (CanIndexWord(strWord, language)) { intWord++; if (IndexWords.ContainsKey(strWord) == false) { IndexWords.Add(strWord, 0); IndexPositions.Add(strWord, 1); } // track number of occurrences of word in content IndexWords[strWord] = Convert.ToInt32(IndexWords[strWord]) + 1; // track positions of word in content IndexPositions[strWord] = Convert.ToString(IndexPositions[strWord]) + "," + intWord.ToString(); } } // get list of words ( non-common ) Hashtable Words = GetSearchWords(); // this could be cached int WordId; //' iterate through each indexed word object objWord; foreach (object tempLoopVar_objWord in IndexWords.Keys) { objWord = tempLoopVar_objWord; strWord = Convert.ToString(objWord); if (Words.ContainsKey(strWord)) { // word is in the DataStore WordId = Convert.ToInt32(Words[strWord]); } else { // add the word to the DataStore WordId = DataProvider.Instance().AddSearchWord(strWord); Words.Add(strWord, WordId); } // add the indexword int SearchItemWordID = DataProvider.Instance().AddSearchItemWord(indexId, WordId, Convert.ToInt32(IndexWords[strWord])); DataProvider.Instance().AddSearchItemWordPosition(SearchItemWordID, Convert.ToString(IndexPositions[strWord])); } }
public static void Delete(int educationLevelId) { DataProvider.Instance().EducationLevels_Delete(educationLevelId); }
public static int Create(EducationLevelInfo info) { return(DataProvider.Instance().EducationLevels_Insert(info.Name, info.Description, info.CreatedBy, info.CreatedDate)); }
public ViewModel() { this.Data = new ObservableCollection <CategoricalData>(DataProvider.GetCategoricalData()); }
public static List <EducationLevelInfo> GetAll() { return(ObjectHelper.FillCollection <EducationLevelInfo>(DataProvider.Instance().EducationLevels_GetAll())); }
public LoginWindow() { InitializeComponent(); DP = new DataProvider(); }
/// <summary> /// To create the order book of volatility. /// </summary> /// <param name="currentTime">The current time.</param> /// <returns>The order book volatility.</returns> public virtual MarketDepth ImpliedVolatility(DateTimeOffset currentTime) { return(DataProvider.GetMarketDepth(Option).ImpliedVolatility(this, currentTime)); }
public static void DeleteTask(int taskId) { DataProvider.Instance().DeleteTask(taskId); }
public static void DeleteTasks(int moduleId) { DataProvider.Instance().DeleteTasks(moduleId); }
public static Task GetTask(int taskId) { return(CBO.FillObject <Task>(DataProvider.Instance().GetTask(taskId))); }
public static List <Task> GetTasks(int moduleId) { return(CBO.FillCollection <Task>(DataProvider.Instance().GetTasks(moduleId))); }
private void GetMessages(ref StringBuilder config, bool deleteMessagesPreviously) { string md = DataProvider.GetDetalleDispositivo(Id, "GTE_MESSAGING_DEVICE").As(String.Empty); if (md == MessagingDevice.Garmin || md == MessagingDevice.Mpx01) { // cargar todos los posibles responses switch (md) { case MessagingDevice.Garmin: List <Logictracker.Types.BusinessObjects.Messages.Mensaje> resp = DataProvider.GetResponsesMessagesTable(Id, 0); if (deleteMessagesPreviously) { config.Append(GarminFmi.EncodeDataDeletionFor(DataDeletionProtocolId.DeleteAllCannedRepliesOnTheClient).ToTraxFM(this, false)); } if (resp != null && resp.Any()) { var respArr = resp.OrderBy(m => m.Codigo).ToArray(); config.Append(GetCannedResponses4Garmin(respArr)); } break; default: break; } config.Append(Environment.NewLine); //cargar todos los canned messages List <Logictracker.Types.BusinessObjects.Messages.Mensaje> cmt = DataProvider.GetCannedMessagesTable(Id, 0); { if ((cmt != null) && (cmt.Any())) { Logictracker.Types.BusinessObjects.Messages.Mensaje[] messagesParameters = cmt.Where(m => !m.TipoMensaje.DeEstadoLogistico).OrderBy(m => m.Codigo).ToArray(); switch (md) { case MessagingDevice.Garmin: if (deleteMessagesPreviously) { config.Append(GarminFmi.EncodeDataDeletionFor(DataDeletionProtocolId.DeleteAllCannedMessagesOnTheClient).ToTraxFM(this, false)); } config.Append(GetCannedMessages4Garmin(messagesParameters)); break; case MessagingDevice.Mpx01: int count = 0; foreach (Logictracker.Types.BusinessObjects.Messages.Mensaje m in messagesParameters.Take(10)) { count++; string texto = m.Texto.ToUpper().PadRight(32); config.Replace(String.Format("$MENSAJE{0:D2}PARTE01", count), texto.Substring(0, 16)); config.Replace(String.Format("$MENSAJE{0:D2}PARTE02", count), texto.Substring(16, 16)); config.Replace(String.Format("$MENSAJE{0:D2}CODIGO", count), m.Codigo); } for (int i = count; i < 11; i++) { const String texto = " "; config.Replace(String.Format("$MENSAJE0{0:D1}PARTE01", i), texto); config.Replace(String.Format("$MENSAJE0{0:D1}PARTE02", i), texto); config.Replace(String.Format("$MENSAJE{0:D2}CODIGO", count), "00"); } break; } } } } if (!String.IsNullOrEmpty(config.ToString().Trim())) { config.AppendFormat("{0}{0}Envio de Mensajes Generado Exitosamente{0}", Environment.NewLine); config.Insert(0, Fota.VirtualMessageFactory(MessageIdentifier.MessagesStart, 0)); config.Append(Fota.VirtualMessageFactory(MessageIdentifier.MessagesSuccess, 0)); } else { config.AppendLine("No hay mensajes para Enviar"); } }
public DbObjectSaver(ObjectInfo info, QueryComposer composer, DataProvider provider, IDbObjectHandler handler) : base(info, composer, provider, handler) { }
public Day05Solver(DataProvider <string> dataProvider) { this.dataProvider = dataProvider; }
public ActionResult Onama() { ViewBag.Message = "Your application Onama page."; return(Content(DataProvider.GetUserByUsername("z3r0d4y").ToString())); }
internal LazyTableModel(DataProvider dp, bool autoStart, string command, params DbParam [] parameters) : base(dp, autoStart, command, parameters) { }
public static IDbTransaction GetTransaction(DataProvider providerType, IDbConnection iDbConnection) { IDbTransaction iDbTransaction = iDbConnection.BeginTransaction(); return(iDbTransaction); }
public override void OnInspectorGUI() { // Configuration script we are the editor of Configuration configutaion = (Configuration)target; //---- // Default inspector //---- DrawDefaultInspector(); //---- // Draw line //---- //DrawUILine(Color.gray, 2, 15); //---- // Start custom GUI //--- GUILayout.Label("UWP Network Permissions:"); GUILayout.BeginHorizontal(); // Editor button to check if the network permissions are set if (GUILayout.Button("Check Network Permissions", GUILayout.Height(50))) { #if UNITY_WSA Microsoft.MixedReality.Toolkit.Utilities.Editor.UWPCapabilityUtility.RequireCapability( UnityEditor.PlayerSettings.WSACapability.InternetClient, this.GetType()); Microsoft.MixedReality.Toolkit.Utilities.Editor.UWPCapabilityUtility.RequireCapability( UnityEditor.PlayerSettings.WSACapability.InternetClientServer, this.GetType()); Microsoft.MixedReality.Toolkit.Utilities.Editor.UWPCapabilityUtility.RequireCapability( UnityEditor.PlayerSettings.WSACapability.PrivateNetworkClientServer, this.GetType()); Debug.Log("[Permission Configuration] Checked network permissions!"); #else Debug.LogError("[Permission Configuration] Not on UWP build target! Can't check network permission."); #endif } GUILayout.EndHorizontal(); GUILayout.Label("UWP Gaze Permission:"); GUILayout.BeginHorizontal(); // Editor button to check if the gaze permission is set if (GUILayout.Button("Check Gaze Permission", GUILayout.Height(50))) { #if UNITY_WSA Microsoft.MixedReality.Toolkit.Utilities.Editor.UWPCapabilityUtility.RequireCapability( UnityEditor.PlayerSettings.WSACapability.GazeInput, this.GetType()); Debug.Log("[Permission Configuration] Checked gaze permission!"); #else Debug.LogError("[Permission Configuration] Not on UWP build target! Can't check gaze permission."); #endif } GUILayout.EndHorizontal(); GUILayout.Label("Layer Configuration:"); GUILayout.BeginHorizontal(); // Editor button to configure required layers if (GUILayout.Button("Configure Layers", GUILayout.Height(50))) { // Report string string report = ""; // Get the DataProvider and AccuracyGrid for layer configuration DataProvider dataProvider = FindObjectOfType <DataProvider>(); AccuracyGrid accuracyGrid = FindObjectOfType <AccuracyGrid>(); if (dataProvider == null || accuracyGrid == null) { Debug.LogError("[Layer configuration] Did not find data provider or accuracy grid in scene, can't update layers!"); } else { // Make a list of all layers which we need to add List <string> layers = new List <string>(); List <string> newLayers = new List <string>(); // Get all layers from the data provider and accuracy grid which we want to configure foreach (string aoiLayer in dataProvider.eyeTrackingAOILayers) { layers.Add(aoiLayer); } foreach (string visLayer in dataProvider.eyeTrackingVisLayers) { layers.Add(visLayer); } foreach (string checkLayer in dataProvider.eyeTrackingCheckLayers) { layers.Add(checkLayer); } layers.Add(accuracyGrid.gridLayer); // Identify which layers need to be added foreach (var layer in layers) { // Try to get the layer number of this layer, if it doesn't exist the number is -1 if (LayerMask.NameToLayer(layer) > -1) { report += $"\nLayer {layer} already exists."; } else { report += $"\nLayer {layer} is missing!"; newLayers.Add(layer); } } // If we don't have new layers we are done, otherwise continue if (newLayers.Count == 0) { report += "\n\nDone! No layers added."; Debug.Log("[Layer Configuration] Successfully checked layer masks, no layers added.\nDetails:\n" + report); } else { // Make a list of all layers which are empty and could be filled with eye tracking layers List <int> emptyLayerNumbers = new List <int>(); for (int i = 8; i <= 31; i++) { if (LayerMask.LayerToName(i) == "") { emptyLayerNumbers.Add(i); } } // If we don't have enough empty layers abort, otherwise continue if (emptyLayerNumbers.Count < newLayers.Count) { report += "\n\nError! Not enough empty layers."; Debug.LogError("[Layer Configuration] Error! Not enough empty layers.\nDetails:" + report); } else { // Assign every missing layer the next possible layer number Dictionary <int, string> newLayerAssignments = new Dictionary <int, string>(); int emptyLayerNumbersIndex = 0; foreach (var newLayer in newLayers) { newLayerAssignments.Add(emptyLayerNumbers[emptyLayerNumbersIndex], newLayer); emptyLayerNumbersIndex++; } // Open the unity tag manager file SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]); SerializedProperty layersProp = tagManager.FindProperty("layers"); // Set the new assignments foreach (KeyValuePair <int, string> newLayerAssignment in newLayerAssignments) { layersProp.GetArrayElementAtIndex(newLayerAssignment.Key).stringValue = newLayerAssignment.Value; report += $"\nSet layer {newLayerAssignment.Key} to layer {newLayerAssignment.Value}."; } // Save the new file tagManager.ApplyModifiedProperties(); report += $"\n\nDone! {newLayerAssignments.Count} layers added."; Debug.Log($"[Layer Configuration] Successfully added {newLayerAssignments.Count} layer mask{((newLayerAssignments.Count > 1) ? "s" : "")}.\nDetails:\n" + report); } } } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Configure Camera", GUILayout.Height(50))) { // Get the DataProvider and AccuracyGrid for layer configuration DataProvider dataProvider = FindObjectOfType <DataProvider>(); AccuracyGrid accuracyGrid = FindObjectOfType <AccuracyGrid>(); if (dataProvider == null || accuracyGrid == null) { Debug.LogError("[Camera configuration] Did not find data provider or accuracy grid in scene, can't update camera!"); } else { // Calculate Layer Mask without AOIs // Note: As Layers are represented by bits, this calculation is also happening on bit level // We start with the current mask LayerMask cameraLayerMask = Camera.main.cullingMask; // Hide all AOI layers foreach (string aoiLayer in dataProvider.eyeTrackingAOILayers) { cameraLayerMask &= ~(1 << LayerMask.NameToLayer(aoiLayer)); } // Also hide the layers which visualizes the eye tracking data foreach (string visLayer in dataProvider.eyeTrackingVisLayers) { cameraLayerMask &= ~(1 << LayerMask.NameToLayer(visLayer)); } // Hide the check layers foreach (string checkLayer in dataProvider.eyeTrackingCheckLayers) { cameraLayerMask &= ~(1 << LayerMask.NameToLayer(checkLayer)); } // And hide the accuracy grid layer cameraLayerMask &= ~(1 << LayerMask.NameToLayer(accuracyGrid.gridLayer)); // Set the new camera mask Camera.main.cullingMask = cameraLayerMask; } } GUILayout.EndHorizontal(); }
public IPagedList <LiveChatViewModel> GetChatHistory(int portalID, int type, string departments, string agents, string visitorEmail, DateTime?fromDate, DateTime?toDate, int rating, bool unread, int pageIndex, int pageSize, int totalCount) { var condition = new StringBuilder(string.Format("PortalID={0} ", portalID)); string dbo = DataProvider.Instance().DatabaseOwner; string oq = DataProvider.Instance().ObjectQualifier; //all | chat | offline if (type == 1) //chat { condition.AppendFormat(" and LiveChatID in (Select LiveChatID From {0}[{1}MyDnnSupport_LiveChatAgents])", dbo, oq); } else if (type == 2) //offline { condition.AppendFormat(" and LiveChatID not in (Select LiveChatID From {0}[{1}MyDnnSupport_LiveChatAgents])", dbo, oq); } if (rating == 1 || rating == 2) { condition.Append(string.Format(" and Rate = {0}", rating)); } else if (rating == 3) { condition.Append(" and (Rate = 1 or Rate = 2)"); } //departments if (type != 2 && !string.IsNullOrEmpty(departments)) { string departmentsCondition = " and LiveChatID in (Select LiveChatID From {0}[{1}MyDnnSupport_LiveChatDepartments] Where {2})"; foreach (var dep in departments.Split(',')) { int value; if (int.TryParse(dep, out value)) { departmentsCondition = departmentsCondition.Replace("[OR]", " or {0}"); departmentsCondition = string.Format(departmentsCondition, dbo, oq, string.Format("DepartmentID = {0} [OR]", value)); } } departmentsCondition = departmentsCondition.Replace("[OR]", string.Empty); condition.Append(departmentsCondition); } //agents if (type != 2 && !string.IsNullOrEmpty(agents)) { string agentsCondition = " and LiveChatID in (Select LiveChatID From {0}[{1}MyDnnSupport_LiveChatAgents] Where {2})"; foreach (var agent in agents.Split(',')) { int value; if (int.TryParse(agent, out value)) { agentsCondition = agentsCondition.Replace("[OR]", " or {0}"); agentsCondition = string.Format(agentsCondition, dbo, oq, string.Format("UserID = {0} [OR]", value)); } } agentsCondition = agentsCondition.Replace("[OR]", string.Empty); condition.Append(agentsCondition); } //visitor email if (!string.IsNullOrEmpty(visitorEmail)) { condition.AppendFormat(" and VisitorEmail like N'%{0}%'", visitorEmail); } //set date culture var fromDateVal = fromDate != null?fromDate.Value.ToString(new CultureInfo("en-US")) : SqlDateTime.MinValue.Value.ToString(new CultureInfo("en-US")); var toDateVal = toDate != null?toDate.Value.ToString(new CultureInfo("en-US")) : SqlDateTime.MaxValue.Value.ToString(new CultureInfo("en-US")); //date range condition.AppendFormat(" and CreateDate >= '{0}' and CreateDate<= '{1}'", fromDateVal, toDateVal); int from = pageIndex * pageSize + 1; int to = from + pageSize; string query = string.Format("SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY CreateDate desc) AS RowNum, * FROM {0}[{1}MyDnnSupport_LiveChats] Where {2}) AS RowConstrainedResult WHERE RowNum >= {3} AND RowNum < {4} ORDER BY RowNum", dbo, oq, condition.ToString(), from, to); var allDepartments = DepartmentManager.Instance.GetDepartments(portalID); var allAgents = AgentManager.Instance.GetAgents(portalID); using (IDataContext ctx = DataContext.Instance()) { if (pageIndex == 0) { totalCount = ctx.ExecuteScalar <int>(System.Data.CommandType.Text, string.Format("Select Count(*) From {0}[{1}MyDnnSupport_LiveChats] Where {2}", dbo, oq, condition)); } var livechats = ctx.ExecuteQuery <LiveChatInfo>(System.Data.CommandType.Text, query); var result = livechats.Select(r => new LiveChatViewModel() { LiveChatID = r.LiveChatID, Visitor = new LiveChatVisitorViewModel() { UserID = r.VisitorUserID, Avatar = r.VisitorUserID > 0 ? DotNetNuke.Common.Globals.ResolveUrl("~/dnnimagehandler.ashx?mode=profilepic&userid=" + r.VisitorUserID) : string.Empty, DisplayName = r.VisitorName, Email = r.VisitorEmail, IP = r.VisitorIP, UserAgent = r.VisitorUserAgent }, Departments = LiveChatDepartmentManager.Instance.GetLiveChatDepartmentsViewModel(portalID, r.LiveChatID), Agents = LiveChatAgentManager.Instance.GetLiveChatAgentsViewModel(portalID, r.LiveChatID), Message = r.VisitorMessage, CreateDate = r.CreateDate }); return(new PagedList <LiveChatViewModel>(result, totalCount, pageIndex, pageSize)); } }
private void btn_LogIn_Click(object sender, EventArgs e) { if (txt_UserName.Text == "" || txt_PassWord.Text == "") { MessageBox.Show("Vui lòng nhập đầy đủ thông tin!", "Thông báo"); return; } SqlConnection conn; conn = DataProvider.OpenConnection(); int temp; if (checkBoxNhanVien.Checked) { temp = 1; } else { temp = 0; } string proc = "DangNhapHeThong"; SqlCommand cmd = new SqlCommand(proc); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; try { cmd.CommandType = CommandType.StoredProcedure; //cmd.Connection = cn; cmd.Parameters.Add("@tenDangNhap", SqlDbType.NVarChar).Value = txt_UserName.Text; cmd.Parameters.Add("@matKhau", SqlDbType.VarChar).Value = txt_PassWord.Text; cmd.Parameters.Add("@isNhanVien", SqlDbType.Int).Value = temp; //Doc du lieu cua Procedure SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { MessageBox.Show("Đăng nhập thành công!\nXin chào " + (string)(reader[1])); Program.username = txt_UserName.Text; if (checkBoxNhanVien.Checked) { this.Hide(); NhanVienQuanLy nvql = new NhanVienQuanLy(); nvql.ShowDialog(); DataProvider.CloseConnection(conn); this.Close(); } else { if (txt_UserName.Text != "admin") { this.Hide(); TimKiemKhachSan tkks = new TimKiemKhachSan(); tkks.ShowDialog(); DataProvider.CloseConnection(conn); this.Close(); } else { this.Hide(); Admin ad = new Admin(); ad.ShowDialog(); DataProvider.CloseConnection(conn); this.Close(); } } } else { MessageBox.Show("Thông tin đăng nhập không đúng.Vui lòng kiểm tra lại", "Lỗi Đăng Nhập", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_PassWord.Text = ""; txt_UserName.Text = ""; } } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.Message); } }
/// <summary> /// Gets memory usage for this node (optionally) for the given time period, optionally sampled if pointCount is specified /// </summary> /// <param name="start">Start date, unbounded if null</param> /// <param name="end">End date, unbounded if null</param> /// <param name="pointCount">Points to return, if specified results will be sampled rather than including every point</param> /// <returns>Memory usage data points</returns> public IEnumerable <MemoryUtilization> GetMemoryUtilization(DateTime?start, DateTime?end, int?pointCount = null) { return(DataProvider.GetMemoryUtilization(this, start, end, pointCount)); }
public async Task <IActionResult> OnPostDeleteAsync(Guid id) { await DataProvider.deleteKorisnik(id); return(RedirectToPage()); }
public static List <EducationLevelInfo> Search(string keyword, int pageIndex, int pageSize, out int totalRecord) { return(FillEducationLevelCollection(DataProvider.Instance().EducationLevels_Search(keyword, pageIndex, pageSize), out totalRecord)); }
public async Task <IActionResult> OnPostUpdateAsync() { await DataProvider.updateKorisnik(Korisnik); return(RedirectToPage()); }
public static EducationLevelInfo GetInfo(int educationLevelId) { return(ObjectHelper.FillObject <EducationLevelInfo>(DataProvider.Instance().EducationLevels_GetInfo(educationLevelId))); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _dataProvider = new DataProvider(); }
public static void Update(EducationLevelInfo info) { DataProvider.Instance().EducationLevels_Update(info.EducationLevelId, info.Name, info.Description, info.CreatedBy, info.CreatedDate); }
public ActionResult GetUsers() { return(Content(DataProvider.GetAllUsers()[0].ToString())); }
/// <summary> /// GetSearchItems gets a collection of Search Items for a Module/Tab/Portal /// </summary> /// <param name="PortalID">A Id of the Portal</param> /// <param name="TabID">A Id of the Tab</param> /// <param name="ModuleID">A Id of the Module</param> /// <history> /// [cnurse] 11/15/2004 documented /// </history> public override SearchResultsInfoCollection GetSearchItems(int PortalID, int TabID, int ModuleID) { return(new SearchResultsInfoCollection(CBO.FillCollection(DataProvider.Instance().GetSearchItems(PortalID, TabID, ModuleID), typeof(SearchResultsInfo)))); }
private SearchItemInfoCollection GetSearchItems(int ModuleId) { return(new SearchItemInfoCollection(CBO.FillCollection(DataProvider.Instance().GetSearchItems(Null.NullInteger, Null.NullInteger, ModuleId), typeof(SearchItemInfo)))); }