private void startButton_Click(object sender, EventArgs e) { d = new datos(this); d.Hide(); x = new details(this, d); x.Show(); this.Hide(); }
public details enter(details obj1) { int age = obj1.age; string name = obj1.name; string pob = obj1.placeofbirth; return(obj1); }
public void enemy(details details) { this.name = details.name; this.str = details.str; this.mbl = details.mbl; this.wis = details.wis; this.hp = details.hp; this.armor = details.armor; this.xp = details.xp; }
public void newitem(details details) { this.nazwa = details.nazwa; this.cena = details.cena; this.itemtype = details.itemtype; this.bonustype = details.bonustype; this.bonus = details.bonus; this.id = details.id; this.exist = true; }
// POST api/<controller> public void Post([FromBody] details value) { try { using (SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { SqlCommand cmd; if (value.mCurrentEditId == null) { cmd = new SqlCommand("InsertToDetails", sqlConn); } else { cmd = new SqlCommand("UpdateDetails", sqlConn); cmd.Parameters.Add("@pCurrentEditId", SqlDbType.Int).Value = int.Parse(value.mCurrentEditId); value.mDateofAuto = value.mDateofAuto.AddDays(-1); } cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@pDateOfAuto", SqlDbType.Date).Value = value.mDateofAuto.AddDays(1); cmd.Parameters.Add("@pTribunal", SqlDbType.NVarChar).Value = value.mTribunal ?? ""; cmd.Parameters.Add("@pTypeOfAuto", SqlDbType.NVarChar).Value = value.mselTypeofAuto ?? ""; cmd.Parameters.Add("@pLocationofAuto", SqlDbType.NVarChar).Value = value.mLocationofAuto ?? ""; cmd.Parameters.Add("@pName", SqlDbType.NVarChar).Value = value.mtxtName ?? ""; cmd.Parameters.Add("@pAliases", SqlDbType.NVarChar).Value = value.mAliases ?? ""; cmd.Parameters.Add("@pGender", SqlDbType.NVarChar).Value = value.mselGender ?? ""; cmd.Parameters.Add("@pPersonalStatus", SqlDbType.NVarChar).Value = value.mselPersonalStatus ?? ""; cmd.Parameters.Add("@pOccupation", SqlDbType.NVarChar).Value = value.mOccupation ?? ""; cmd.Parameters.Add("@pFamilyTies", SqlDbType.NVarChar).Value = value.mFamilyTies ?? ""; cmd.Parameters.Add("@pLocationOfBirth", SqlDbType.NVarChar).Value = value.mLocationOfBirth ?? ""; cmd.Parameters.Add("@pResidence", SqlDbType.NVarChar).Value = value.mResidence ?? ""; cmd.Parameters.Add("@pTypeOfCrime", SqlDbType.NVarChar).Value = value.mTypeOfCrime ?? ""; cmd.Parameters.Add("@pSentence", SqlDbType.NVarChar).Value = value.mSentence ?? ""; cmd.Parameters.Add("@pAdditionalInformation", SqlDbType.NVarChar).Value = value.mAdditionalInformation ?? ""; cmd.Parameters.Add("@pAge", SqlDbType.NVarChar).Value = value.mAge; cmd.Parameters.Add("@pGenealogicalOrigin", SqlDbType.NVarChar).Value = value.mGenealogicalOrigin ?? ""; cmd.Parameters.Add("@pSurname", SqlDbType.NVarChar).Value = value.mSurname ?? ""; cmd.Parameters.Add("@pBishopricOfBirth", SqlDbType.NVarChar).Value = value.mBishopricOfBirth ?? ""; cmd.Parameters.Add("@pBishopricOfResidence", SqlDbType.NVarChar).Value = value.mBishopricOfResidence ?? ""; cmd.Parameters.Add("@pPunishment", SqlDbType.NVarChar).Value = value.mPunishment ?? ""; sqlConn.Open(); cmd.ExecuteNonQuery(); sqlConn.Close(); } } catch (Exception ex) { } finally { } }
public async Task <IActionResult> Getdetails(string id) { details details = await db.Details.FindAsync(id); //get details of the person parking based on vehicle number if (details == null) { return(NotFound("Id is not valid")); } return(Ok(details)); }
public bool can_vote(details obj) { int age = obj.age; if (age > 18) { return(true); } else { return(false); } }
public async Task <IActionResult> Deletedetails(string id) { details details = await db.Details.FindAsync(id); if (details == null) { return(NotFound("Invalid id")); } db.Details.Remove(details); await db.SaveChangesAsync(); return(Ok(details)); }
public async Task <string> saveVoucherAsync(details source) { RecordDetails k = new RecordDetails(); var h = _context.Catalogue.Where(s => s.ItemName == source.ItemName).First().ItemNumber; k.ItemNumber = h; k.Rrid = source.VoNo; k.Remark = source.Remark; k.Quantity = source.Quantity; _context.RecordDetails.Add(k); await _context.SaveChangesAsync(); return("ok"); }
public static Boolean check(string email1, string pass1) { Boolean ab = false; details obj = new details(); SqlConnection con = Open(); SqlCommand cmd = new SqlCommand("select * from register where [email protected] and [email protected]", con); cmd.Parameters.AddWithValue("@e",email1); cmd.Parameters.AddWithValue("@p", pass1); SqlDataReader sdr = cmd.ExecuteReader(); if (sdr.HasRows) { ab = true; } sdr.Close(); con.Close(); return ab; }
public static int insert(details d) { SqlConnection con = Open(); SqlCommand cmd = new SqlCommand("insert register values(@f,@l,@a,@s,@d,@q,@e,@p)",con); cmd.Parameters.AddWithValue("@f", d.fname); cmd.Parameters.AddWithValue("@l", d.lname); cmd.Parameters.AddWithValue("@a", d.age); cmd.Parameters.AddWithValue("@s", d.sex); cmd.Parameters.AddWithValue("@d", d.dob.ToShortDateString()); cmd.Parameters.AddWithValue("@q", d.qual); cmd.Parameters.AddWithValue("@e", d.email); cmd.Parameters.AddWithValue("@p", d.pass); int res = cmd.ExecuteNonQuery(); con.Close(); return res; }
protected void Button1_Click(object sender, EventArgs e) { if (CheckBox1.Checked == true) { string sexd = RadioButton1.Checked ? "Male" : "Female"; details d = new details { fname = TextBox1.Text, lname = TextBox2.Text, age = int.Parse(TextBox3.Text), sex = sexd, dob = Calendar1.SelectedDate, qual = DropDownList1.SelectedValue, email = TextBox4.Text, pass = TextBox6.Text }; int res = details.insert(d); if (res > 0) { Response.Write("<script>alert('Registered Successfully')</script>"); } else { Response.Write("<script>alert('ERROR!!! Try Again')</script>"); } } else { Response.Write("<script>alert('Must abide all the rules')</script>"); } }
static void Main(string[] args) { strore obj = new strore(); details obj1 = new details() { age = Convert.ToInt32(Console.ReadLine()), name = Console.ReadLine(), placeofbirth = Console.ReadLine(), }; if (obj.can_vote(obj1)) { obj.enter(obj1); obj.show(obj1); } else { Console.WriteLine("sorry wrong input"); } Console.ReadKey(); }
public ActionResult Transition_IletisimBilgileriniGuncelle(FormCollection formCollection) { try { Iletisim_Model iletisim_model = (Iletisim_Model)MTranslation.BuildObject(formCollection, "Iletisim_Model"); if (iletisim_model.tel1 != "" && iletisim_model.email != "" && iletisim_model.address != "") { akgul_yemek_dbEntities db = new akgul_yemek_dbEntities(); details detail_address = db.details.Where(w => w.key_ == "address").FirstOrDefault(); details detail_email = db.details.Where(w => w.key_ == "email").FirstOrDefault(); details detail_tel1 = db.details.Where(w => w.key_ == "tel1").FirstOrDefault(); details detail_tel2 = db.details.Where(w => w.key_ == "tel2").FirstOrDefault(); detail_address.value = iletisim_model.address; detail_email.value = iletisim_model.email; detail_tel1.value = iletisim_model.tel1; detail_tel2.value = iletisim_model.tel2; db.SaveChanges(); Session["message"] = new MessageModel("Bilgi", "İletişim Bilgileri Güncellendi.", Message_Type.Success); return(RedirectToAction("Iletisim")); } else { MLog.Error("İletişim Bilgileri Güncellenemedi.", "Eksik veya Yanlış Bilgiler Girildi."); Session["message"] = new MessageModel("ERROR", "Eksik veya Yanlış Bilgiler Girildi.", Message_Type.Error); return(RedirectToAction("Iletisim")); } } catch (Exception exception) { MLog.Error("İletişim Bilgileri Güncellenemedi.", exception.Message + Environment.NewLine + exception.StackTrace); Session["message"] = new MessageModel("HATA", "Bir Hata Oluştu.", Message_Type.Error); return(RedirectToAction("Iletisim")); } }
public async Task <IActionResult> Postdetails(details details) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } parkingslot p1 = db.Parkingslots.Where(x => x.availability == Availability.Available).FirstOrDefault(); if (p1 == null) { return(BadRequest("There is no available slot to park the vehicle")); } else { details.date = details.date; p1.availability = Availability.Occupied; details.Slot = p1.sl; db.Details.Add(details); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (detailsExists(details.vehicleNo)) { return(Conflict("This vehicle is already parked")); } else { throw; } } return(CreatedAtAction("Getdetails", new { id = details.vehicleNo }, details)); } }
public ActionResult Transition_IcerikGuncelle(FormCollection formCollection) { try { details contentDetail = (details)MTranslation.BuildObject(formCollection, "details"); akgul_yemek_dbEntities db = new akgul_yemek_dbEntities(); details willUpdateContentDetail = db.details.Where(w => w.key_ == contentDetail.key_).FirstOrDefault(); willUpdateContentDetail.value = contentDetail.value; db.SaveChanges(); Session["message"] = new MessageModel("Bilgi", "İçerik Güncellendi.", Message_Type.Success); return(RedirectToAction("Icerik", new { id = contentDetail.key_ })); } catch (Exception exception) { MLog.Error("Site Iceriği Güncellenemedi.", exception.Message + Environment.NewLine + exception.StackTrace); Session["message"] = new MessageModel("HATA", "Bir Hata Oluştu.", Message_Type.Error); return(RedirectToAction("Icerik")); } }
public void Form1Test() { // calling the constructor of the details class with passing the values details obj = new details("check", 1, 1, 1); }
public void readFromCSVfile1() { var assembly = IntrospectionExtensions.GetTypeInfo(typeof(Maps)).Assembly; Stream stream1 = assembly.GetManifestResourceStream("CoronaTracker.Resources.countries2.csv"); string text1 = null; using (var reader = new System.IO.StreamReader(stream1)) { text1 = reader.ReadToEnd(); } List <string> ls = new List <string>(); ls.Add(text1.Replace('\n', ',')); string[] fields = null; fields = ls[0].Split(','); string tempLat = ""; string tempLon = ""; string tempCountryName = ""; for (int i = 0; i < fields.Length; i = i + 2) { tempLat = fields[i]; tempLon = fields[i + 1]; tempCountryName = fields[i + 2]; i++; tempCountryName.Trim('\r'); CountryString.Add(tempCountryName); details detail = new details(tempLat, tempLon); lonLatLocationInfo.Add(detail); foreach (var item in Jcountries.countries_stat) { if (item.country_name.ToString() == tempCountryName.Trim('\r')) { Pin pin = new Pin { Label = item.country_name.ToString(), Address = "Active corona cases: " + item.active_cases.ToString(), Type = PinType.Place, Position = new Position(detail.lat, detail.lon), }; map.Pins.Add(pin); int red = 255; int green = 0; string casesLevel = item.cases.ToString(); string deathLevel = item.deaths.ToString(); double deathNum = Double.Parse(deathLevel); double Level = Double.Parse(casesLevel); if (Level < 200000) { red = 200; } else { red = 0; } if (deathNum < 15000) { green = 200; } else { green = 0; } Circle circle = new Circle { Center = new Position(detail.lat, detail.lon), Radius = new Distance(75000), StrokeColor = Color.FromRgba(0, green, 0, 0.5), StrokeWidth = 11, FillColor = Color.FromRgba(red, 0, 0, 0.5), }; map.MapElements.Add(circle); } } } }
static void Main(string[] args) { Program p = new Program(); details[] customer = new details[100]; Console.WriteLine("Start"); CloudStorageAccount storageAccount = CloudStorageAccount.Parse( ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString); tableClient = storageAccount.CreateCloudTableClient(); //Console.WriteLine("Enter port number to make connnection......!"); // Int32 port = Convert.ToInt32(Console.ReadLine()); while (true) { p.processfun(); } }
public void send_to_table() { int count = 0; //to send data to the azure table. using (XmlReader reader = XmlReader.Create("D:\\dataforCSharp.xml")) { while (reader.Read()) { if (reader.IsStartElement()) { //return only when you have START tag switch (reader.Name) { case "col": // Detect this article element. //Console.WriteLine("Start <col> element."); // Search for the attribute name on this current node. string attribute = reader["name"]; // Next read will contain text. if (reader.Read()) { if (attribute == "ieee") IEEE = reader.Value.Trim(); else if (attribute == "devicefunction") DeviceFunction = reader.Value.Trim(); else if (attribute == "devicetype") DeviceType = reader.Value.Trim(); else if (attribute == "devicename") DeviceName = reader.Value.Trim(); else if (attribute == "devtabid") DeviceTableID = reader.Value.Trim(); else if (attribute == "ep") Endpoint = reader.Value.Trim(); else if (attribute == "vendorname") Vendorname = reader.Value.Trim(); else if (attribute=="energy1") Energy_off = reader.Value.Trim(); else if (attribute=="energy2") Energy_On = reader.Value.Trim(); else if (attribute == "customername") { customername = reader.Value.Trim(); if (count == 0) { var date = DateTime.Now; table = tableClient.GetTableReference(customername + date.Hour); try { if (table.CreateIfNotExists()) { Console.Write(customername + " Table "); Console.WriteLine("Created "); } else { Console.WriteLine(customername + " Table not created"); } } catch (StorageException s) { Console.WriteLine("Refresh and retry " + s.ToString()); return; } } count++; } else if (attribute == "value") Value = reader.Value.Trim(); else if (attribute == "id") { Id = reader.Value.Trim(); TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1); string t1 = DateTime.Now.ToString(); details d1 = new details(customername, t.TotalMilliseconds.ToString()); d1.id = Id; d1.devicefunction = DeviceFunction; d1.devicename = DeviceName; d1.devicetype = DeviceType; d1.devtabid = DeviceTableID; d1.ep = Endpoint; d1.vendorname = Vendorname; d1.IEEE = IEEE; d1.datetime = t1; d1.energy1 = Energy_On; d1.energy2 = Energy_off; TableOperation insertOperation = TableOperation.Insert(d1); // Execute the insert operation. try { table.Execute(insertOperation); Console.WriteLine(customername + " Record Inserted"); } catch (Exception e) { Console.WriteLine(e.ToString()); continue; } } } break; } } } } }
/// <summary> /// Gets all the details required for rendering the Create UI /// </summary> public Dictionary<string, List<details>> getAllUserCreateDetails() { Dictionary<string, List<details>> allDetails = new Dictionary<string, List<details>>(); #region get all Brands //Brand[] BrandsA = _entities.Brands.OrderBy(brand => brand.Name).ToArray(); Brand[] BrandsA = (from b in _entities.Brands from c in b.Customers select b).ToArray(); List<details> BrandsDetails = new List<details>(); BrandsDetails.Add(new details(0, "All", false)); foreach (var brand in BrandsA) { details brandDetail; brandDetail = new details(brand.ID, brand.Name, false); BrandsDetails.Add(brandDetail); } allDetails.Add("brands", BrandsDetails); #endregion #region get all Languages Culture[] culturesA = _entities.Cultures.Where(culture => culture.IsSupported == true).OrderBy(culture => culture.Locale).ToArray(); //create custom list of Brands List<details> culturesDetails = new List<details>(); //Add 'All' to the collection culturesDetails.Add(new details(0, "All", false)); foreach (var culture in culturesA) { details cultureDetail; cultureDetail = new details(culture.ID, culture.Locale, false); culturesDetails.Add(cultureDetail); } allDetails.Add("cultures", culturesDetails); #endregion #region get all Regions Region[] regionsA = _entities.Regions.OrderBy(region => region.Name).ToArray(); //create custom list of regions List<details> regionsDetails = new List<details>(); //Add 'All' to the collection regionsDetails.Add(new details(0, "All", false)); foreach (var region in regionsA) { details regionDetail; regionDetail = new details(region.ID, region.Name, false); regionsDetails.Add(regionDetail); } allDetails.Add("regions", regionsDetails); #endregion return allDetails; }
public void UnitTest_1() { details obj = new details(); }
// [ResponseType(typeof(void))] public async Task <IActionResult> Putdetails(string id, [FromBody] details details) { // details details = await db.Details.FindAsync(id); if (!ModelState.IsValid) { return(BadRequest(ModelState)); //update details } if (id != details.vehicleNo) { return(BadRequest("Id is not valid")); } if (details.outTime < details.inTime) { return(BadRequest("out time cannot be smaller than in time")); } string v; DateTime date; double outTime; if (details.outTime != null) { details.cost = (details.outTime - details.inTime) * 3; parkingslot p = db.Parkingslots.Where(x => x.sl == details.Slot).FirstOrDefault(); p.availability = Availability.Available; backup b = new backup(); b.name = details.name; b.contactNumber = details.contactNumber; b.vehicleNo = details.vehicleNo; b.date = details.date; // b.floor = details.serialno.floor; // b.slot = details.serialno.slot; // b.section = details.serialno.section; b.slot = Convert.ToInt32(details.Slot); b.inTime = details.inTime; b.outTime = Convert.ToDouble(details.outTime); b.cost = Convert.ToDouble(details.cost); db.Backups.Add(b); v = b.vehicleNo; date = b.date.Date; outTime = b.outTime; db.Entry(details).State = EntityState.Modified; try { await db.SaveChangesAsync(); db.Details.Remove(details); await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!detailsExists(id)) { return(NotFound()); } else { throw; } } return(CreatedAtAction("GetBackups", new { controller = "backups", id = v }, details)); } else { db.Entry(details).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!detailsExists(id)) { return(NotFound("Id is not valid")); } else { throw; } } return(CreatedAtAction("Getdetails", new { controller = "details", id = id }, details)); } }
// GET: Function public ActionResult Index(string id) { var d = new details(); var total = new List <details>(); int count = 0; PhoneBookDbEntities db = new PhoneBookDbEntities(); Person obj = new Person(); var list = db.AspNetUsers.ToList(); foreach (var i in list) { if (i.Id == id) { var l = db.People.ToList(); foreach (var a in l) { if (a.AddedBy == i.Id) { count++; } } } } d.PersonAdded = count; // for next 10 dayss AspNetUser u = db.AspNetUsers.Find(id); //Person bdp = db.People.Find(id); var plist = db.People.ToList(); DateTime date = DateTime.Today.AddDays(3); DateTime date1 = DateTime.Today.AddDays(7); DateTime date2 = DateTime.Today.AddDays(1); DateTime date3 = DateTime.Today.AddDays(2); DateTime date4 = DateTime.Today.AddDays(4); DateTime date5 = DateTime.Today.AddDays(5); DateTime date6 = DateTime.Today.AddDays(6); DateTime date7 = DateTime.Today.AddDays(7); DateTime date8 = DateTime.Today.AddDays(8); DateTime date9 = DateTime.Today.AddDays(9); d.totalname = new List <lists>(); foreach (var i in plist) { if (i.AddedBy == u.Id) { DateTime dob = Convert.ToDateTime(i.DateOfBirth);// dob=date of birth if (dob.Day == date.Day && dob.Month == date.Month || dob.Day == date1.Day && dob.Month == date1.Month || dob.Day == date2.Day && dob.Month == date2.Month || dob.Day == date3.Day && dob.Month == date3.Month || dob.Day == date4.Day && dob.Month == date4.Month || dob.Day == date5.Day && dob.Month == date5.Month || dob.Day == date6.Day && dob.Month == date6.Month || dob.Day == date7.Day && dob.Month == date7.Month || dob.Day == date8.Day && dob.Month == date8.Month || dob.Day == date9.Day && dob.Month == date9.Month) { d.totalname.Add(new lists() { name1 = i.FirstName }); } } } // for prevoius 7 days.. DateTime date11 = DateTime.Today.AddDays(-1); DateTime date12 = DateTime.Today.AddDays(-2); DateTime date13 = DateTime.Today.AddDays(-3); DateTime date14 = DateTime.Today.AddDays(-4); DateTime date15 = DateTime.Today.AddDays(-5); DateTime date16 = DateTime.Today.AddDays(-6); DateTime date17 = DateTime.Today.AddDays(-7); d.totalpersons = new List <listsofpersons>(); foreach (var i in plist) { if (i.AddedBy == u.Id) { DateTime dou = Convert.ToDateTime(i.UpdateOn);// dou =date of update if (dou.Day == date11.Day && dou.Month == date11.Month || dou.Day == date12.Day && dou.Month == date12.Month || dou.Day == date13.Day && dou.Month == date13.Month || dou.Day == date14.Day && dou.Month == date14.Month || dou.Day == date15.Day && dou.Month == date15.Month || dou.Day == date16.Day && dou.Month == date16.Month || dou.Day == date17.Day && dou.Month == date17.Month) { d.totalpersons.Add(new listsofpersons() { name3 = i.FirstName }); } } } return(View(d)); }
private static void Dispatcher(object sender, CustomActionEventArgs e) { GdPicturePDF oPdf = new GdPicturePDF(); switch (e.actionName) { //loading document and setting annotations access control //the workflow is designed for PDF files, you can apply similar workflow on the other formats using GdPictureImaging class case "load": load oLoad = JsonConvert.DeserializeObject <load>(e.args.ToString()); GdPictureStatus status = oPdf.LoadFromFile(HttpRuntime.AppDomainAppPath + "\\Files\\" + oLoad.Path, true); AnnotationManager oAnnotationmanager = new AnnotationManager(); oAnnotationmanager.InitFromGdPicturePDF(oPdf); for (int i = 1; i < oAnnotationmanager.PageCount; i++) { oAnnotationmanager.SelectPage(i); for (int y = 0; y < oAnnotationmanager.GetAnnotationCount(); y++) { Annotation annot = oAnnotationmanager.GetAnnotationFromIdx(y); if (oLoad.UserType == "user") //case for external user member { if (annot.Tag != oLoad.UserType) //annotation is not vissible if not added by external group memebr { annot.Visible = false; } } else if (oLoad.UserType == "staff") //case for staff member { annot.Visible = true; //all annot are visible } } oAnnotationmanager.SaveAnnotationsToPage(); } e.docuVieware.LoadFromGdPicturePdf(oPdf); e.docuVieware.DisplayPage(1); break; //setting annotation tag that represents access group and saving annotation to PDF //the workflow is designed for PDF files, you can apply similar workflow on the other formats using GdPictureImaging class case "setAnnotationTag": e.docuVieware.GetNativePDF(out oPdf); AnnotationManager manager = new AnnotationManager(); manager.InitFromGdPicturePDF(oPdf); details oDetails = JsonConvert.DeserializeObject <details>(e.args.ToString()); manager.SelectPage(oDetails.annot.pageNo); int pages = manager.GetAnnotationCount(); for (int i = 0; i < pages; i++) { Annotation oAnnotation = manager.GetAnnotationFromIdx(i); if (oAnnotation.Guid == oDetails.annot.id) { oAnnotation.Tag = oDetails.type; } } manager.SaveAnnotationsToPage(); status = oPdf.SaveToFile(HttpRuntime.AppDomainAppPath + "\\Files\\DocuViewareFlyer.pdf", true); break; } }
public void show(details obj) { Console.WriteLine("{0},{1},{2}", obj.age, obj.name, obj.placeofbirth); }
/// <summary> /// Gets all the details required for rendering the Edit UI /// </summary> public Dictionary<string, List<details>> getAllUserEditDetails(User user) { Dictionary<string, List<details>> allDetails = new Dictionary<string, List<details>>(); User contextUser = _entities.Users.Where(userCnt => userCnt.ID == user.ID).First(); #region get all Brands //get all the existing Brands for the User contextUser.Brands.Load(); //user.Brands.Load(); Brand[] userBrands = contextUser.Brands.OrderBy(brand => brand.Name).ToArray(); //get all the brands //Brand[] brandsAO = _entities.Brands.OrderBy(brand => brand.Name).ToArray(); Brand[] brandsA = (from b in _entities.Brands from c in b.Customers select b).ToArray(); //create custom list of brands List<details> brandsDetails = new List<details>(); //Add 'All' to the collection brandsDetails.Add(new details(0 , "All" ,false )); foreach (var brand in brandsA) { details brandDetail; if (userBrands.Contains(brand)) { brandDetail = new details(brand.ID, brand.Name , true); } else { brandDetail = new details(brand.ID, brand.Name, false); } brandsDetails.Add(brandDetail); } allDetails.Add("brands", brandsDetails); #endregion #region get all Languages //get all the existing cultures for the User contextUser.Cultures.Load(); Culture[] userCulture = contextUser.Cultures.OrderBy(culture => culture.Locale).ToArray(); //get all the cultures Culture[] culturesA = _entities.Cultures.Where(culture => culture.IsSupported == true).OrderBy(culture => culture.Locale).ToArray(); //create custom list of brands List<details> culturesDetails = new List<details>(); //Add 'All' to the collection culturesDetails.Add(new details(0, "All", false)); foreach (var culture in culturesA) { details cultureDetail; if (userCulture.Contains(culture)) { cultureDetail = new details(culture.ID, culture.Locale, true); } else { cultureDetail = new details(culture.ID, culture.Locale, false); } culturesDetails.Add(cultureDetail); } allDetails.Add("cultures", culturesDetails); #endregion #region get all Regions //get all the existing Regions for the User contextUser.Regions.Load(); Region[] userRegion = contextUser.Regions.OrderBy(region => region.Name).ToArray(); //get all the regions from the database Region[] regionsA = _entities.Regions.OrderBy(Region => Region.Name).ToArray(); //create custom list of regions List<details> regionsDetails = new List<details>(); //Add 'All' to the collection regionsDetails.Add(new details(0, "All", false)); foreach (var region in regionsA) { details regionDetail; if (userRegion.Contains(region)) { regionDetail = new details(region.ID, region.Name, true); } else { regionDetail = new details(region.ID, region.Name, false); } regionsDetails.Add(regionDetail); } allDetails.Add("regions", regionsDetails); #endregion return allDetails; }
public void Form1Test() { details obj = new details(); }