public static int UpdatePerson(string personId, string firstName, string lastName, string emailAddress, DateTime dob, string gender, string phoneNumber) { var gen = (gender == "male") ? "1" : "0"; PersonM data = new PersonM { PersonId = personId, FirstName = firstName, LastName = lastName, EmailAddress = emailAddress, DateOfBirth = dob, Gender = gen, PhoneNumber = phoneNumber }; string sql = @"UPDATE dbo.Person SET PersonId=@PersonId, FirstName = @FirstName, LastName = @LastName, EmailAddress = @EmailAddress, DateOfBirth = @DateOfBirth, PhoneNumber = @PhoneNumber WHERE PersonId = @PersonId;"; return(SqlDataAccess.SaveData(sql, data)); }
private static string ToCsv(PersonM person) => string.Join("|", person.Id.ToString(), person.Name, person.Segments == null ? string.Empty : string.Join(",", person.Segments.Select(x => x.Id)), person.Keywords == null ? string.Empty : string.Join(",", person.Keywords.Select(x => x.Id)));
public void Eliminar(PersonM item) { using (IDbConnection conexion = new SqlConnection(ConexionBD.ObtenerCadenaConexion())) { conexion.Open(); var parametros = new DynamicParameters(); parametros.Add("@p_cedula", item.Cedula); var Persona = conexion.Query <PersonM>("dbo.sp_persona_eliminar", param: parametros, commandType: CommandType.StoredProcedure); } }
public PersonM Modificar(PersonM item) { using (IDbConnection conexion = new SqlConnection(ConexionBD.ObtenerCadenaConexion())) { conexion.Open(); var parametros = new DynamicParameters(); parametros.Add("@p_cedula", item.Cedula); parametros.Add("@p_nombre", item.Nombre); parametros.Add("@p_telefono", item.Telefono); var Persona = conexion.Query("dbo.sp_persona_modificar", param: parametros, commandType: CommandType.StoredProcedure); return(item); } }
public void StaticHtml(string LoginName, string Title, string KeyWord, string Descript) { PersonBLL perbll = new PersonBLL(); PersonM model = perbll.GetModelByLoginName(LoginName); string PersonTems = PersonTem.ToString(); string TempSoure = Compage.Reader(PersonTems); if (model != null) { string img = ""; if (string.IsNullOrEmpty(model.img.ToString())) { img = "http://www.topfo.com/dservice/image/photo.jpg"; } else { img = "http://dp.topfo.com/img/" + LoginName + "/" + model.img.ToString(); } string imgstr = "<img id=\"imgPerson\" src=" + img + " style=\"height:106px;width:155px;border-width:0px;\" />"; //string strName = model.name + " " + model.birthDay.ToString("yyyy年MM月dd日") + "出生 " + model.address.ToString(); string strName = model.name;// +" " + model.birthDay.ToString("yyyy年MM月dd日") + "出生 " + model.address.ToString(); TempSoure = TempSoure.Replace("$Name$", strName); TempSoure = TempSoure.Replace("[userName]", LoginName); TempSoure = TempSoure.Replace("[暂无图片]", imgstr); TempSoure = TempSoure.Replace("[暂无格言]", model.signature.ToString()); TempSoure = TempSoure.Replace("[暂无介绍]", SubStr(model.description.ToString(), 185)); TempSoure = TempSoure.Replace("$Title$", Title.ToString().Trim()); TempSoure = TempSoure.Replace("$Description$", KeyWord.ToString().Trim()); TempSoure = TempSoure.Replace("$KeyWords$", Descript.ToString().Trim()); } else { string img = "http://www.topfo.com/dservice/image/photo.jpg"; string imgstr = "<img id=\"imgPerson\" src=" + img + " style=\"height:106px;width:155px;border-width:0px;\" />"; TempSoure = TempSoure.Replace("$Name$", ""); TempSoure = TempSoure.Replace("[userName]", LoginName); TempSoure = TempSoure.Replace("[暂无图片]", imgstr); TempSoure = TempSoure.Replace("$Title$", Title.ToString().Trim()); TempSoure = TempSoure.Replace("$Description$", KeyWord.ToString().Trim()); TempSoure = TempSoure.Replace("$KeyWords$", Descript.ToString().Trim()); } string htmlpaths = PersonSuccess + "lm" + LoginName + "\\index.htm"; if (!Directory.Exists(PersonSuccess + "lm" + LoginName)) { Directory.CreateDirectory(PersonSuccess + "lm" + LoginName); } Compage.Writer(htmlpaths, TempSoure); StaticHtmls(LoginName); }
/// <summary> /// Person property update method /// </summary> /// <param name = "person"> person object </param> /// <param name = "model"> Person model </param> /// <returns> </returns> public static Person UpdateProperties(this Person person, PersonM model) { person.Address = model.Address; person.BirthDate = model.BirthDate; person.CountryId = model.CountryId; person.GivenName = model.GivenName; person.PersonalId = model.PersonalId; person.PhoneNumber = model.PhoneNumber; person.PhoneNumber1 = model.PhoneNumber1; person.Sex = model.Sex; person.Surname = model.Surname; person.MiddleName = model.MiddleName; return(person); }
public ActionResult Edit(PersonM model) { if (ModelState.IsValid) { int records = PersonProccesor.UpdatePerson(model.PersonId, model.FirstName, model.LastName, model.EmailAddress, model.DateOfBirth, model.Gender, model.PhoneNumber); return(RedirectToAction("ViewPersons")); } return(View()); }
public override void FromCsv(string csv) { var props = csv.Split('|'); if (props.Length != 4) { throw new ArgumentException("Incorrect number of values.", csv); } var person = new PersonM(int.Parse(props[0]), props[1]) { Csv = props }; _model.All.Add(person); _model.AllDic.Add(person.Id, person); }
public void Eliminar(string cedula) { try { using (var instancia = new ServiceBL()) { PersonM item = new PersonM(); item.Cedula = cedula; instancia.Eliminar(item); } } catch (Exception ex) { throw new Exception("Error"); } }
public PersonM Modificar(string cedula, string nombre, string telefono) { try { using (var instancia = new ServiceBL()) { PersonM item = new PersonM(); item.Cedula = cedula; item.Nombre = nombre; item.Telefono = telefono; return(instancia.Modificar(item)); } } catch (Exception ex) { throw new Exception("Error"); } }
public static int CreatePerson(string personId, string firstName, string lastName, string emailAddress, DateTime dob, string gender, string phoneNumber) { var gen = (gender == "male") ? "1" : "0"; PersonM data = new PersonM { PersonId = personId, FirstName = firstName, LastName = lastName, EmailAddress = emailAddress, DateOfBirth = dob, Gender = gen, PhoneNumber = phoneNumber }; string sql = @"INSERT INTO dbo.Person (PersonId,FirstName,LastName, EmailAddress ,DateOfBirth, PhoneNumber) VALUES (@PersonId, @FirstName, @LastName, @EmailAddress, @DateOfBirth, @PhoneNumber);"; return(SqlDataAccess.SaveData(sql, data)); }
public PersonM Modificar(PersonM item) { IServiceDAL instancia = new ServiceDAL(); return(instancia.Modificar(item)); }
public PersonM Crear(PersonM item) { IServiceDAL instancia = new ServiceDAL(); return(instancia.Crear(item)); }
public SegmentPersonChangeEventArgs(SegmentM segment, PersonM oldPerson, PersonM newPerson) { Segment = segment; OldPerson = oldPerson; NewPerson = newPerson; }
public PersonDeletedEventArgs(PersonM person) { Person = person; }
public PersonM Detalle(PersonM item) { return(null); }
public void Eliminar(PersonM item) { IServiceDAL instancia = new ServiceDAL(); instancia.Eliminar(item); }