public void GetUserById() { var name = "Maurício"; var userId = Guid.NewGuid(); var tel = new Telphone(); tel.SetPrefix(21); tel.SetNumber("31785826"); var profile = new Profile(); profile.SetName(name); profile.SetUserId(userId); profile.AddTelphone(tel); var repository = GetProfileRepository(); repository.Insert(profile); var response = repository.GetByUserId(profile.UserId); Assert.Equal(profile.Name, response.Name); Assert.Equal(profile.UserId, response.UserId); Assert.NotNull(profile.Telphones); Assert.Equal(profile.Telphones.Count, 1); }
public MemberSelectBuild WhereTelphoneLike(params string[] Telphone) { if (Telphone == null || Telphone.Where(a => !string.IsNullOrEmpty(a)).Any() == false) { return(this); } return(this.Where1Or(@"a.`telphone` LIKE {0}", Telphone.Select(a => "%" + a + "%").ToArray())); }
protected override void OnCollect(ICriteriaPool <UserArticle> pool) { pool.Add(x => x.Type == Type, Type > (int)ZDBACKOFFICE.ArticleType.All) .Add(x => x.Status == Status, Status != (int)AuditStatus.All) .Add(x => x.User.UserName == UserName.Trim(), !string.IsNullOrEmpty(UserName)) .Add(x => x.User.Telphone == Telphone.Trim(), !string.IsNullOrEmpty(Telphone)) .Add(x => x.CreateDate >= StartDate && x.CreateDate <= Convert.ToDateTime(EndDate).AddDays(1)); }
public void SetNumberWhenNumberIsEmpty() { var tel = new Telphone(); var number = ""; Exception ex = Assert.Throws <PreConditionException>(() => tel.SetNumber(number)); Assert.Equal("Informe o número do telefone.", ex.Message); }
public void SetNumber() { var tel = new Telphone(); var number = "31785826"; tel.SetNumber(number); Assert.Equal(tel.Number, number); }
public void SetPrefixWhenPrefixIsZero() { var tel = new Telphone(); var prefix = 0; Exception ex = Assert.Throws <PreConditionException>(() => tel.SetPrefix(prefix)); Assert.Equal("Informe o prefixo do telefone.", ex.Message); }
public void SetPrefix() { var tel = new Telphone(); var prefix = 21; tel.SetPrefix(prefix); Assert.Equal(tel.Prefix, prefix); }
public void AddTelphone() { var profile = new Profile(); var telphone = new Telphone(); telphone.SetPrefix(21); telphone.SetNumber("31785826"); profile.AddTelphone(telphone); Assert.Equal(profile.Telphones.Count(), 1); }
public void InsertProfile() { var name = "Maurício"; var userId = Guid.NewGuid(); var tel = new Telphone(); tel.SetPrefix(21); tel.SetNumber("31785826"); var profile = new Profile(); profile.SetName(name); profile.SetUserId(userId); profile.AddTelphone(tel); var repository = GetProfileRepository(); repository.Insert(profile); Assert.True(profile.Id > 0); }
public override string ToString() { string json = string.Concat( __jsonIgnore.ContainsKey("Id") ? string.Empty : string.Format(", Id : {0}", Id == null ? "null" : Id.ToString()), __jsonIgnore.ContainsKey("Member_id") ? string.Empty : string.Format(", Member_id : {0}", Member_id == null ? "null" : Member_id.ToString()), __jsonIgnore.ContainsKey("Address") ? string.Empty : string.Format(", Address : {0}", Address == null ? "null" : string.Format("'{0}'", Address.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Create_time") ? string.Empty : string.Format(", Create_time : {0}", Create_time == null ? "null" : Create_time.Value.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds.ToString()), __jsonIgnore.ContainsKey("Is_default") ? string.Empty : string.Format(", Is_default : {0}", Is_default == null ? "null" : (Is_default == true ? "true" : "false")), __jsonIgnore.ContainsKey("Name") ? string.Empty : string.Format(", Name : {0}", Name == null ? "null" : string.Format("'{0}'", Name.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Tel") ? string.Empty : string.Format(", Tel : {0}", Tel == null ? "null" : string.Format("'{0}'", Tel.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Telphone") ? string.Empty : string.Format(", Telphone : {0}", Telphone == null ? "null" : string.Format("'{0}'", Telphone.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Zip") ? string.Empty : string.Format(", Zip : {0}", Zip == null ? "null" : string.Format("'{0}'", Zip.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), " }"); return(string.Concat("{", json.Substring(1))); }
public override string ToString() { string json = string.Concat( __jsonIgnore.ContainsKey("Id") ? string.Empty : string.Format(", Id : {0}", Id == null ? "null" : Id.ToString()), __jsonIgnore.ContainsKey("Area_id") ? string.Empty : string.Format(", Area_id : {0}", Area_id == null ? "null" : Area_id.ToString()), __jsonIgnore.ContainsKey("Capacity") ? string.Empty : string.Format(", Capacity : {0}", Capacity == null ? "null" : string.Format("'{0}'", Capacity.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Create_time") ? string.Empty : string.Format(", Create_time : {0}", Create_time == null ? "null" : Create_time.Value.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds.ToString()), __jsonIgnore.ContainsKey("Main_business") ? string.Empty : string.Format(", Main_business : {0}", Main_business == null ? "null" : string.Format("'{0}'", Main_business.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Min_order") ? string.Empty : string.Format(", Min_order : {0}", Min_order == null ? "null" : string.Format("'{0}'", Min_order.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Process_cost") ? string.Empty : string.Format(", Process_cost : {0}", Process_cost == null ? "null" : string.Format("'{0}'", Process_cost.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Sampling_period") ? string.Empty : string.Format(", Sampling_period : {0}", Sampling_period == null ? "null" : string.Format("'{0}'", Sampling_period.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Sampling_price") ? string.Empty : string.Format(", Sampling_price : {0}", Sampling_price == null ? "null" : string.Format("'{0}'", Sampling_price.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Telphone") ? string.Empty : string.Format(", Telphone : {0}", Telphone == null ? "null" : string.Format("'{0}'", Telphone.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Title") ? string.Empty : string.Format(", Title : {0}", Title == null ? "null" : string.Format("'{0}'", Title.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Turn_single_time") ? string.Empty : string.Format(", Turn_single_time : {0}", Turn_single_time == null ? "null" : string.Format("'{0}'", Turn_single_time.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), " }"); return(string.Concat("{", json.Substring(1))); }
public override string ToString() { string json = string.Concat( __jsonIgnore.ContainsKey("Id") ? string.Empty : string.Format(", Id : {0}", Id == null ? "null" : Id.ToString()), __jsonIgnore.ContainsKey("Order_id") ? string.Empty : string.Format(", Order_id : {0}", Order_id == null ? "null" : Order_id.ToString()), __jsonIgnore.ContainsKey("Productitem_id") ? string.Empty : string.Format(", Productitem_id : {0}", Productitem_id == null ? "null" : Productitem_id.ToString()), __jsonIgnore.ContainsKey("Create_time") ? string.Empty : string.Format(", Create_time : {0}", Create_time == null ? "null" : Create_time.Value.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds.ToString()), __jsonIgnore.ContainsKey("Descript") ? string.Empty : string.Format(", Descript : {0}", Descript == null ? "null" : string.Format("'{0}'", Descript.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Email") ? string.Empty : string.Format(", Email : {0}", Email == null ? "null" : string.Format("'{0}'", Email.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Img_url") ? string.Empty : string.Format(", Img_url : {0}", Img_url == null ? "null" : string.Format("'{0}'", Img_url.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("State") ? string.Empty : string.Format(", State : {0}", State == null ? "null" : string.Format("'{0}'", State.ToDescriptionOrString().Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Tel") ? string.Empty : string.Format(", Tel : {0}", Tel == null ? "null" : string.Format("'{0}'", Tel.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Telphone") ? string.Empty : string.Format(", Telphone : {0}", Telphone == null ? "null" : string.Format("'{0}'", Telphone.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Wealth") ? string.Empty : string.Format(", Wealth : {0}", Wealth == null ? "null" : Wealth.ToString()), " }"); return(string.Concat("{", json.Substring(1))); }
public override string ToString() { string json = string.Concat( __jsonIgnore.ContainsKey("Id") ? string.Empty : string.Format(", Id : {0}", Id == null ? "null" : Id.ToString()), __jsonIgnore.ContainsKey("Area_id") ? string.Empty : string.Format(", Area_id : {0}", Area_id == null ? "null" : Area_id.ToString()), __jsonIgnore.ContainsKey("Address") ? string.Empty : string.Format(", Address : {0}", Address == null ? "null" : string.Format("'{0}'", Address.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Create_time") ? string.Empty : string.Format(", Create_time : {0}", Create_time == null ? "null" : Create_time.Value.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds.ToString()), __jsonIgnore.ContainsKey("Service_features") ? string.Empty : string.Format(", Service_features : {0}", Service_features == null ? "null" : string.Format("'{0}'", Service_features.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Telphone") ? string.Empty : string.Format(", Telphone : {0}", Telphone == null ? "null" : string.Format("'{0}'", Telphone.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Title") ? string.Empty : string.Format(", Title : {0}", Title == null ? "null" : string.Format("'{0}'", Title.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), " }"); return(string.Concat("{", json.Substring(1))); }
public override string ToString() { string json = string.Concat( __jsonIgnore.ContainsKey("Id") ? string.Empty : string.Format(", Id : {0}", Id == null ? "null" : Id.ToString()), __jsonIgnore.ContainsKey("Create_time") ? string.Empty : string.Format(", Create_time : {0}", Create_time == null ? "null" : Create_time.Value.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds.ToString()), __jsonIgnore.ContainsKey("Email") ? string.Empty : string.Format(", Email : {0}", Email == null ? "null" : string.Format("'{0}'", Email.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Lastlogin_time") ? string.Empty : string.Format(", Lastlogin_time : {0}", Lastlogin_time == null ? "null" : Lastlogin_time.Value.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds.ToString()), __jsonIgnore.ContainsKey("Telphone") ? string.Empty : string.Format(", Telphone : {0}", Telphone == null ? "null" : string.Format("'{0}'", Telphone.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Username") ? string.Empty : string.Format(", Username : {0}", Username == null ? "null" : string.Format("'{0}'", Username.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), " }"); return(string.Concat("{", json.Substring(1))); }
public override string ToString() { string json = string.Concat( __jsonIgnore.ContainsKey("Order_id") ? string.Empty : string.Format(", Order_id : {0}", Order_id == null ? "null" : Order_id.ToString()), __jsonIgnore.ContainsKey("Address") ? string.Empty : string.Format(", Address : {0}", Address == null ? "null" : string.Format("'{0}'", Address.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Name") ? string.Empty : string.Format(", Name : {0}", Name == null ? "null" : string.Format("'{0}'", Name.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Tel") ? string.Empty : string.Format(", Tel : {0}", Tel == null ? "null" : string.Format("'{0}'", Tel.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Telphone") ? string.Empty : string.Format(", Telphone : {0}", Telphone == null ? "null" : string.Format("'{0}'", Telphone.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), __jsonIgnore.ContainsKey("Zip") ? string.Empty : string.Format(", Zip : {0}", Zip == null ? "null" : string.Format("'{0}'", Zip.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))), " }"); return(string.Concat("{", json.Substring(1))); }