public static string GetTypeName(int id) { CustomertypeModel ct = new CustomertypeModel(); ct = ct.Get(id); return(ct.Name); }
public CustomertypeModel ReturnMeFromDataRow(DataRow dr) { CustomertypeModel cm = new CustomertypeModel { Id = System.Convert.ToInt32(dr[0].ToString()), Name = dr[1].ToString() }; return(cm); }
public CustomertypeModel ReturnMeFromDataTable(DataTable dt) { CustomertypeModel cm = new CustomertypeModel(); foreach (DataRow row in dt.Rows) { this.Id = System.Convert.ToInt32(row[0].ToString()); this.Name = row[1].ToString(); } return(this); }
private CustomerModel GetMeFromRow(DataRow row) { CustomerModel ctm = new CustomerModel { Id = System.Convert.ToInt32(row[0].ToString()), Name = row[1].ToString(), Type = System.Convert.ToInt32(row[2].ToString()), TypeName = CustomertypeModel.GetTypeName(System.Convert.ToInt32(row[2])), Phone = row[3].ToString(), Email = row[4].ToString(), }; return(ctm); }
public BindableCollection <CustomertypeModel> GetCollection(DataTable types) { List <CustomertypeModel> output = new List <CustomertypeModel>(); foreach (DataRow row in types.Rows) { CustomertypeModel fm = new CustomertypeModel { Id = System.Convert.ToInt32(row[0].ToString()), Name = row[1].ToString(), }; output.Add(fm); } return(new BindableCollection <CustomertypeModel>(output)); }
public BindableCollection <CustomerModel> SearchBy(string search, string name) { BindableCollection <CustomerModel> customers = new BindableCollection <CustomerModel>(); CustomerModel customer = new CustomerModel(); List <KeyValuePair <string, string[]> > Data = new List <KeyValuePair <string, string[]> >(); string[] value; switch (search) { case "Name": value = new string[2] { "", name }; Data.Add(new KeyValuePair <string, string[]>("name", value)); break; case "Customer Type Name": CustomertypeModel customer_types = new CustomertypeModel(); List <CustomertypeModel> types = new List <CustomertypeModel>(); types = customer_types.GetListOfNameSimilarTo(name); List <CustomerModel> css = new List <CustomerModel>(); foreach (CustomertypeModel type in types) { List <CustomerModel> NewCustomers = new List <CustomerModel>(); NewCustomers = GetCustomersOfType(type.Id); foreach (CustomerModel c in NewCustomers) { css.Add(c); } } return(new BindableCollection <CustomerModel>(css)); case "Customer Type Id": value = new string[2] { "number", name }; Data.Add(new KeyValuePair <string, string[]>("type_id", value)); break; default: return(null); } customers = customer.GiveCollection(customer.FindByLikeParameters(Data)); return(customers); }