public static void Add(ORM orm) { Console.Write("\nFirstName: "); string fn = Console.ReadLine(); Console.Write("LastName: "); string ln = Console.ReadLine(); Console.Write("Age: "); int age = Convert.ToInt32(Console.ReadLine()); Console.Write("PhoneNumber: "); string pn = Console.ReadLine(); Console.Write("Email: "); string em = Console.ReadLine(); orm.Add(new People { FirstName = fn, LastName = ln, Age = age, PhoneNumber = pn, Email = em }); }
public override FlowStepToolboxInformation[] GetStepsInformation(string[] nodes, string flowId, string folderId) { // return step info if (nodes == null || nodes.Length != 4 || nodes[0] != "Data" || nodes[1] != PARENT_NODE) { return(new FlowStepToolboxInformation[0]); } List <FlowStepToolboxInformation> list = new List <FlowStepToolboxInformation>(); CRM2011Connection connection = CRM2011Connection.GetCRMConnectionForName(nodes[2]); if (connection == null) { return(new FlowStepToolboxInformation[0]); } ORM <CRM2011Entity> orm = new ORM <CRM2011Entity>(); CRM2011Entity[] crmEntities = orm.Fetch(new WhereCondition[] { new FieldWhereCondition("connection_id", QueryMatchType.Equals, connection.connectionId), new FieldWhereCondition("crm_entity_display_name", QueryMatchType.Equals, nodes[3]) }); foreach (CRM2011Entity entity in crmEntities) { list.Add(new FlowStepToolboxInformation("Get All Entities", nodes, string.Format(GET_ALL_STEP_INFO + "${0}", entity.entityId))); list.Add(new FlowStepToolboxInformation("Get Entity By Id", nodes, string.Format(GET_STEP_INFO + "${0}", entity.entityId))); list.Add(new FlowStepToolboxInformation("Add Entity", nodes, string.Format(ADD_STEP_INFO + "${0}", entity.entityId))); list.Add(new FlowStepToolboxInformation("Update Entity", nodes, string.Format(UPDATE_STEP_INFO + "${0}", entity.entityId))); list.Add(new FlowStepToolboxInformation("Delete Entity", nodes, string.Format(DELETE_STEP_INFO + "${0}", entity.entityId))); } return(list.ToArray()); }
private static void Initiate() { Console.CursorVisible = false; ORM.FetchData(ref passengers, ref trains, ref stations, ref timeTables); PrintHeader(); worldTime = DateTime.Parse(GENESIS_TIME); }
public override SiteMapNode BuildSiteMap() { const string queryRootNode = "ELEMENT (SELECT o FROM SiteMapExtent AS o WHERE o.ParentSiteMap = nil )"; if (rootNode == null) { lock (this) { UO_Model.Execution.SiteMap rt; using (IQueryResult result = ORM.ObjectScope().GetOqlQuery(queryRootNode).Execute()) { if (result.Count > 0) { rt = result[0] as UO_Model.Execution.SiteMap; } else { throw new ApplicationException(MSG.SiteMap_Root_Not_Fould); } } rootNode = new SiteMapNode(this, rt.SiteMap_ID.ToString(), rt.URL, rt.Title, rt.Description); AddNode(rootNode); AddChildSiteMaps(rt, rootNode); } } return(rootNode); }
public void Initialize() { ORM <Folder> orm = new ORM <Folder>(); if (orm.Fetch("OPCBaseFolder") == null) { Folder f = new Folder(); f.FolderID = "OPCBaseFolder"; f.CanBeRoot = true; f.EntityName = "OPC Servers"; f.FolderBehaviorType = typeof(OPCServersFolderBehavior).FullName; f.Store(); } ORM <PageData> pageDataOrm = new ORM <PageData>(); PageData pageData = pageDataOrm.Fetch(new WhereCondition[] { new FieldWhereCondition("configuration_storage_id", QueryMatchType.Equals, SERVERS_PAGE_ID), new FieldWhereCondition("entity_folder_id", QueryMatchType.Equals, "OPCBaseFolder") }).FirstOrDefault(); if (pageData == null) { pageDataOrm.Store(new PageData { EntityFolderID = "OPCBaseFolder", ConfigurationStorageID = SERVERS_PAGE_ID, EntityName = "Servers", Order = -1 }); } LookupListRegistration.Instance.RegisterObjectForType(typeof(OPCDataProvider), new OPCLookupListProvider()); }
/// <summary> /// Validate the user based upon username and password. /// </summary> /// <param name="username">User name.</param> /// <param name="password">Password.</param> /// <returns>T/F if the user is valid.</returns> public override bool ValidateUser(string username, string password) { IObjectScope objScope = ORM.GetNewObjectScope(); bool isValid = false; Employee e = ResolveEmployeeByName(objScope, username); if (e == null) { return(false); } if (CheckPassword(password, e.Password)) { if (e.IsApproved) { isValid = true; objScope.Transaction.Begin(); e.LastLoginDate = DateTime.Now; objScope.Transaction.Commit(); } } else { UpdateFailureCount(objScope, e, FailureType.Password); } return(isValid); }
public static void Add(ORM orm) { Console.Write("\nCountry: "); string country = Console.ReadLine(); Console.Write("City: "); string city = Console.ReadLine(); Console.Write("Oblast: "); string oblast = Console.ReadLine(); Console.Write("Region: "); string region = Console.ReadLine(); Console.Write("Street: "); string street = Console.ReadLine(); Console.WriteLine("House: "); int house = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Flat: "); int flat = Convert.ToInt32(Console.ReadLine()); orm.Add(new Addresses { Country = country, City = city, Oblast = oblast, Region = region, Street = street, House = house, Flat = flat }); }
/// <summary> /// Find all users matching a search string of their email. /// </summary> /// <param name="emailToMatch">Search string of email to match.</param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="totalRecords">Total records found.</param> /// <returns>Collection of MembershipUser objects.</returns> public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords) { IObjectScope objScope = ORM.GetNewObjectScope(); const string queryEmployeesByEMail = @"SELECT * FROM EmployeeExtent AS o WHERE o.EMail LIKE $1"; return(QueryMembershipUsers(objScope, queryEmployeesByEMail, emailToMatch, pageIndex, pageSize, out totalRecords)); }
/// <summary> /// Get a user based upon provider key and if they are on-line. /// </summary> /// <param name="userID">Provider key.</param> /// <param name="userIsOnline">T/F whether the user is on-line.</param> /// <returns></returns> public override MembershipUser GetUser(object userID, bool userIsOnline) { IObjectScope objScope = ORM.GetNewObjectScope(); Employee e = ResolveEmployeeByID(objScope, userID.ToString()); return(GetMembershipUser(objScope, userIsOnline, e)); }
/// <summary> /// Get a collection of users. /// </summary> /// <param name="pageIndex">Page index.</param> /// <param name="pageSize">Page size.</param> /// <param name="totalRecords">Total # of records to retrieve.</param> /// <returns>Collection of MembershipUser objects.</returns> public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords) { IObjectScope objScope = ORM.GetNewObjectScope(); const string queryAllEmployee = @"SELECT * FROM EmployeeExtent AS o"; return(QueryMembershipUsers(objScope, queryAllEmployee, null, pageIndex, pageSize, out totalRecords)); }
/// <summary> /// Change the user password. /// </summary> /// <param name="username">UserName</param> /// <param name="oldPwd">Old password.</param> /// <param name="newPwd">New password.</param> /// <returns>T/F if password was changed.</returns> public override bool ChangePassword(string username, string oldPwd, string newPwd) { if (!ValidateUser(username, oldPwd)) { return(false); } ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, newPwd, true); OnValidatingPassword(args); if (args.Cancel) { if (args.FailureInformation != null) { throw args.FailureInformation; } else { throw new Exception("Change password canceled due to new password validation failure."); } } IObjectScope objScope = ORM.GetNewObjectScope(); objScope.Transaction.Begin(); Employee e = ResolveEmployeeByName(objScope, username); e.Password = EncodePassword(newPwd); e.LastPasswordChangedDate = DateTime.Now; objScope.Transaction.Commit(); return(true); }
static void Main(string[] args) { try { UpdateConfigs(args); PrintConfigValues(); ORM.Init(); Console.WriteLine("DB connected successfully\n"); if (args.Contains("-clear")) { ORM.Storage.Clear(); Console.WriteLine("Storage table cleared"); return; } Console.WriteLine("Files parsing starting..."); var parser = new DataParser(); var storageValues = parser.ParseAll(); Console.WriteLine("Files parsing finished\n"); Console.WriteLine("Storage table inserting..."); ORM.Storage.Insert(storageValues); Console.WriteLine("Inserting finished\n"); } catch (Exception e) { Console.WriteLine(e.Message); } }
//测试实例 private void btnSample_Click(object sender, EventArgs e) { messageFactory factory = new messageFactory(); ACK msg = factory.Create(null, enumMessage.ACK, "ACK") as ACK; msg.msh.FieldSeparator.Value = "|"; msg.msh.EncodingCharacters.Value = "^~\\&"; msg.msh.DateOrTimeOfMessage.Value = DateTime.Now.ToString("yyyyMMddhhmmss.fff"); msg.msh.MessageType.messagecode.Value = "ACK"; msg.msh.MessageType.triggerevent.Value = "A01"; msg.msh.MessageType.messagestructure.Value = "ACK_A01"; //msg.msh.MessageType.Value = "ACK^A01^ACK_A01"; msg.msh.MessageControlID.Value = "A00002"; msg.msh.ProcessingID.processingID.Value = "P"; msg.msh.VersionID.versionID.Value = "2.4"; msg.msa.AcknowledgmentCode.Value = "AA"; msg.msa.MessageControlID.Value = "MSG00001"; msg.msa.TextMessage.Value = "Success"; txMessage.Text = msg.ToString() + "\n"; ORM orm = factory.Create(null, enumMessage.ORM, "ORM") as ORM; orm.msh.FieldSeparator.Value = "|"; orm.msh.EncodingCharacters.Value = "^~\\&"; orm.msh.DateOrTimeOfMessage.Value = DateTime.Now.ToString("yyyyMMddhhmmss.fff"); orm.msh.MessageType.messagecode.Value = "ORM"; orm.msh.MessageType.triggerevent.Value = "001"; orm.msh.MessageType.messagestructure.Value = "ORM_001"; orm.pid.PatientName.Value = "Wangzifu"; txMessage.Text += orm.ToString(); }
public static Node MapFromDb(ORM.Node sqlNode) { if (sqlNode.AdjacentNodes != null) { return new Node(sqlNode.Id, sqlNode.Label, sqlNode.AdjacentNodes1.Select(adj => adj.AdjacentId).ToList()); } return new Node(sqlNode.Id, sqlNode.Label); }
public static void GetAll(ORM ado) { Console.WriteLine(); foreach (var s in ado.GetAllStatus()) { Console.WriteLine("{0}\t{1}", s.Id, s.Status); } }
public static void GetAll(ORM orm) { Console.WriteLine(); foreach (var a in orm.GetAllAddresses()) { Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}", a.Id, a.Country, a.City, a.Oblast, a.Region, a.Street, a.House, a.Flat); } }
public static void GetAll(ORM ado) { Console.WriteLine(); foreach (var p in ado.GetAllPeople()) { Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", p.Id, p.FirstName, p.LastName, p.Age, p.PhoneNumber, p.Email); } }
public bool Register(ORM.PatientBasicInfo oPatient) { oDataContext.PatientBasicInfos.InsertOnSubmit(oPatient); oDataContext.SubmitChanges(); //oDataContext.PatientBasicInfos.su //check exception here return true; }
public static void GetAll(ORM orm) { Console.WriteLine(); foreach (var car in orm.GetAllCars()) { Console.WriteLine("{0}\t{1}\t{2}\t{3}", car.Id, car.Brand, car.Number, car.Year); } }
private void CarregarGridTotesSeries() { series = ORM.retornarSeriesSearch(""); GridViewSeries.Columns[6].Visible = false; GridViewSeries.DataSource = series; GridViewSeries.DataBind(); }
public void PlaceOrder(List <cart> list) { if (list.Count != 0) { DataTable dt = ORM.ConvertIntoTable <cart>(list); DataBase.InsertIntoDB("PlaceOrder", dt, "@carttb", new SqlParameter[] { new SqlParameter("@uid", this.UserID) }); } }
public static void GetAll(ORM ado) { Console.WriteLine(); foreach (var t in ado.GetAllTypes()) { Console.WriteLine("{0}\t{1}", t.Id, t.Name); } }
//Funció per a loguejar protected void ButtonEntrar_Click(object sender, EventArgs e) { _usuari = null; string nomUsuari = TextBoxNomUsuari.Text; string pwd = TextBoxContrasenya.Text; String regexPwd = "(?=^.{6,255}$)((?=.*\\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\\d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*\\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*"; if (Regex.IsMatch(pwd, regexPwd)) { if (Regex.IsMatch(nomUsuari, "^[a-zA-Z]{4,9}$")) { _usuari = ORM.buscarUsuariContrasenya(nomUsuari, pwd); if (_usuari != null) { ScriptManager.RegisterStartupScript(this, typeof(Page), "script", "document.getElementById('alertError').style.display = 'none';", true); Session["usuari"] = _usuari; _usuari = (Usuaris)Session["usuari"]; Response.Redirect("index.aspx"); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "script", "document.getElementById('alertError').style.display = 'inline-block';", true); LabelError.Text = "Wrong user or password. Please check out again your credentials."; } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "script", "document.getElementById('alertError').style.display = 'inline-block';", true); LabelError.Text = "Invalid username."; } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "script", "document.getElementById('alertError').style.display = 'inline-block';", true); LabelError.Text = "Invalid password." + "<br/>" + "- Must not contain username." + "<br/>" + "- It must be between 6 and 10 characters, contain at least one digit and one alphabetic character, and must not contain special characters."; } try { _usuari = ORM.buscarUsuariContrasenya(nomUsuari, pwd); } catch {} if (_usuari != null) { ScriptManager.RegisterStartupScript(this, typeof(Page), "script", "document.getElementById('alertError').style.display = 'none';", true); Session["usuari"] = _usuari; _usuari = (Usuaris)Session["usuari"]; Response.Redirect("index.aspx"); } netejarDades(); }
public string GetStatus(AbstractUserContext userContext, string externalEntityInvocationId) { ORM <ExternalInvocationEntity> externalInvocationEntityOrm = new ORM <ExternalInvocationEntity>(); ExternalInvocationEntity externalInvocationEntity = externalInvocationEntityOrm.Fetch(externalEntityInvocationId); Log.Warn("Get Status Operation Successfully Invoked"); return(externalInvocationEntity.Status); }
private void SetObjectData(JObject objectData) { this.connectStr = (String)(objectData["connectStr"]); this.tableName = objectData["tableName"] == null ? String.Empty : (String)objectData["tableName"]; this.codeType = objectData["codeType"] == null ? String.Empty : (String)objectData["codeType"]; var ormval = objectData["ORM"] == null ? "None" : (String)objectData["ORM"]; orm = Enum.Parse <ORM>(ormval, true); }
public void SetUp() { sessionFactory = ORM <Adherent> .CreateSessionFactory(true); dataAccess = new DataAccess(sessionFactory); servicePrets = new ServicePrets(dataAccess); CreateFixtures(); PopulateDatabase(); }
public string GetCode(string tableName, ORM ORMType, DataTable dtTables, DataTable dtColumns) { StringBuilder sb = new StringBuilder(); sb.Append("export class " + tableName); sb.AppendLine(" {"); appendProperty(ref sb, dtColumns); sb.AppendLine("}"); return(sb.ToString()); }
public static void Remove(ORM orm) { Console.Write("\nEnter the id you want to remove: "); int id = Convert.ToInt32(Console.ReadLine()); orm.Remove(new Cars { Id = id }); }
public static void Add(ORM orm) { Console.Write("\nName: "); string name = Console.ReadLine(); orm.Add(new Types { Name = name }); }
public static void Add(ORM orm) { Console.Write("\nStatus: "); string status = Console.ReadLine(); orm.Add(new DeliveryStatus { Status = status }); }
//Fetch all the steps using a specified Database Connection Name. //The databaseConnectionName parameter will become a step input. //The step will return an array of step names and the table they connect to public string[] FetchStepsUsingDbConnection(string databaseConnectionName) { //Create the results list to return List<string> stepResultsList = new List<string>(); //Use the ORM to get all FLOW element registrations ElementRegistration[] allFlows = new ORM<ElementRegistration>().Fetch(new WhereCondition[] { new FieldWhereCondition("is_flow", QueryMatchType.Equals, true), }); //Loop through each flow foreach (ElementRegistration reg in allFlows) { //Open the flow Flow flow = FlowEngine.LoadFlowByID(reg.ComponentRegistrationId, false, true); FlowStep currentStep = null; try { //Loop through each step in the current flow foreach (FlowStep step in flow.Steps) { currentStep = step; //If the step is a GetAllStep, Process it if (step.FlowStepType.Equals("GetAllStep`1")) { //Cast the step.WrappedStep into the appropriate step type. GetAllStep<DatabaseTableDefinition> getAllStep = (GetAllStep<DatabaseTableDefinition>) step.WrappedStep; //If the step is on the appropriate connection, add it to the results. if (string.Equals(getAllStep.DBConnectionName, databaseConnectionName)) { stepResultsList.Add("Flow Name: " + flow.Name + " | Step Name: " + step.Name + " | DB Connection Name: " + getAllStep.DBConnectionName + " | Table Name: " + getAllStep.TableName); } } } } catch (Exception ex) { if (flow != null && currentStep != null) { stepResultsList.Add("Failed | Flow Name: " + flow.Name + " | Step Name: " + currentStep.Name); } if (flow != null) { _log.Error(ex, "Error processing steps for Flow: " + flow.Name + " with ID: " + flow.Id); } } } return stepResultsList.ToArray(); }
//Funció per seguir/deixar de seguir serie protected void FollowButton_Click(object sender, EventArgs e) { //Si l'usuari segueix serie seleccionada el botó cambia a default/primary amb text = unfollow String nomSerie = LabelNomSerie.Text; //Series serie = ORM.buscarSerie(nomSerie); ORM.afegirEliminarSerie(_usuari, nomSerie); comprobarSeguimentSerie(_usuari, nomSerie); initialize(); }
public void BasicTest() { var target = new ORM("Library.mdb"); var expected = new List<Book> { new Book { Author = "Asimov", Title = "Pebble In The Sky", Pages = 235}, new Book { Author = "Asimov", Title = "Foundation and Empire", Pages = 325}, new Book { Author = "Asimov", Title = "Foundation", Pages = 466}, new Book { Author = "Asimov", Title = "Second Foundation", Pages = 388}, new Book { Author = "Asimov", Title = "The Caves of Steel ", Pages = 989}, new Book { Author = "Asimov", Title = "The End of Eternity", Pages = 234}, }; var actual = target.Get<Book>( book => book.Author == "Asimov" ); Assert.That(actual, Is.EqualTo(expected)); }
/// <summary> /// Send an forget password email to user /// </summary> /// <param name="user">User who forget the password</param> /// <returns></returns> public static bool sendForgetPassword(ORM.User user) { string Content = string.Format(getMailTemplate("Template_ForgetPassword"),user.UserName, user.Password); sendHTMLMail("*****@*****.**", user.Email, "Quên mật khẩu", Content); return true; }
public ActionResult Edit(ORM.Pictures pictures) { try { if (ModelState.IsValid) { _repository.UpdatePicture(pictures.ToBllPicture()); return RedirectToAction("Index"); } ModelState.AddModelError("", "Произошла ошибка!"); return View(pictures); } catch (Exception exception) { return PartialView("_Error", exception); } }
public string Verify(ORM.PatientBasicInfo oPatient) { string sErrorInfo = string.Empty; //var tmpPat = from BasicInfo in oDataContext.PatientBasicInfos // let ConValue=(BasicInfo.NationalID==oPatient.NationalID) ? "Duplicate NID" : "Duplicate Parents" // where (BasicInfo.NationalID == oPatient.NationalID ) select // new { BasicInfo.PatientID,BasicInfo.PatientName,BasicInfo.NationalID, // VerfyField=ConValue}; //if (tmpPat.Count() > 0) //{ // sErrorInfo = BL.LocalResourse.ErrorMessages.DuplicateNID; // return sErrorInfo; //} //Notes: oDataContext ORM SQL data object & oPatient from valu object //var varDupLicateFMName = from BasicInfo in oDataContext.PatientBasicInfos // where (BasicInfo.Relationship==oPatient.Relationship && // BasicInfo.PatientName==oPatient.PatientName && // BasicInfo.FatherName==oPatient.FatherName) // select new // { // BasicInfo.PatientID, // BasicInfo.PatientName, // BasicInfo.NationalID // }; //if (varDupLicateFMName.Count() > 0 && oPatient.PatientType==3) //{ // sErrorInfo = BL.LocalResourse.ErrorMessages.InvalidInfo; // return sErrorInfo; //} //Added by shahed: Regular var varRegAndStaff = from BasicInfo in oDataContext.PatientBasicInfos where (BasicInfo.PatientType==oPatient.PatientType && BasicInfo.RelCode==oPatient.RelCode && BasicInfo.PatientName==oPatient.PatientName && BasicInfo.FatherName==oPatient.FatherName ) select new { BasicInfo.PatientID, BasicInfo.PatientName, BasicInfo.NationalID }; if (varRegAndStaff.Count() > 0 && oPatient.PatientType!=2) { sErrorInfo = BL.LocalResourse.ErrorMessages.InvalidInfo; return sErrorInfo; } //Added by shahed: Respondant var varRespondant = from BasicInfo in oDataContext.PatientBasicInfos where (BasicInfo.StudyName==oPatient.StudyName && BasicInfo.StudyID==oPatient.StudyID && BasicInfo.RelCode == oPatient.RelCode && BasicInfo.PatientName==oPatient.PatientName && BasicInfo.FatherName==oPatient.FatherName ) select new { BasicInfo.PatientID, BasicInfo.PatientName, BasicInfo.NationalID }; if (varRespondant.Count() > 0 && oPatient.PatientType==2) { sErrorInfo = BL.LocalResourse.ErrorMessages.InvalidInfo; return sErrorInfo; } return sErrorInfo; }