public User(string username, bool guartOn, bool alarmOn, bool keyOnOff, bool datX, int cellgroup, string catRoom, int floor) { InitializeComponent(); InstanceContext instanceContext = new InstanceContext(new ClientServiceCallback()); _clientService = new ClientServiceClient(instanceContext); RommsL = this.Resources["RoomsDataSource"] as RoomCollection; _keysCollectionL = this.Resources["KeysDataSource"] as KeysCollection; _floorId = floor; //определение сом порта этажа // todo надо переписать под универсальную строку коннекта когда будет создан админ // string conn = @"Data Source=microsoft-pc;Initial Catalog=ALFA;Integrated Security=True"; // SqlConnection sqlComPort = new SqlConnection(conn); // sqlComPort.Open(); // string infoAboutComPort = @"SELECT ComPort FROM Floors // WHERE (FloorName = '" + _floorId + "')"; // SqlCommand sqlinfoAboutComPort = new SqlCommand(infoAboutComPort, sqlComPort); // SqlDataReader rezultat = sqlinfoAboutComPort.ExecuteReader(); // rezultat.Read(); // _yComPort = (string)rezultat["ComPort"]; // rezultat.Close(); // sqlComPort.Close(); // ну согласись, лучше чем верхняя портянка, даже если предположить что ты не знаешь Linq то тут все понятно AlfaEntities alfaEntities = new AlfaEntities(); // todo ошибочно считается что не может быть ситуации когда забит этаж и не указан ком порт, надо обработать это исключение _yComPort = (from floorse in alfaEntities.Floors where floorse.FloorId == _floorId select floorse.ComPort).FirstOrDefault(); }
public static void MarkEntityAsInUse <Table>(params object[] keys) where Table : IBqlTable { if (IsEntityInUse <Table>(keys)) { return; } KeysCollection cacheKeys = GetCacheKeys <Table>(); if (cacheKeys.Count() != keys.Length) { throw new PXArgumentException(nameof(keys)); } var fields = new PXDataFieldAssign[cacheKeys.Count]; for (int i = 0; i < cacheKeys.Count; i++) { fields[i] = new PXDataFieldAssign(cacheKeys[i], keys[i]); } try { PXDatabase.Insert <Table>(fields); } catch (PXDatabaseException ex) when(ex.ErrorCode == PXDbExceptions.PrimaryKeyConstraintViolation) { } }
/// <summary> /// Creates an empty observable dictionary /// </summary> public MtObservableSortedDictionary(IComparer <TK> keyCompare = null) { _keyComparer = keyCompare ?? Comparer <TK> .Default; _backing = new List <KeyValuePair <TK, TV> >(); _keyCollection = new KeysCollection(this); _valueCollection = new ValueCollection(this); Lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); }
public void Clear() { KeysCollection keys = Keys; while (keys.Any()) { Remove(keys.First()); } outgoingChanges.RemoveAll((OutgoingChange ch) => !ch.Removal); }
/// <summary> /// Busca un ID de un tipo determinado, si no lo encuentra devuelve el valor por defecto /// </summary> public int?SearchID(int intIDType) { if (IDType == intIDType) { return(ID); } else if (KeysCollection != null) { return(KeysCollection.SearchID(intIDType)); } else { return(null); } }
/// <summary> /// 将集合转换成列表 /// </summary> /// <param name="keysCollection"></param> /// <returns></returns> public static List <string> ToList(this KeysCollection keysCollection) { if (keysCollection != null) { List <string> list = new List <string>(); foreach (var item in keysCollection) { list.Add(item.ToString()); } return(list); } return(null); }
public ActionResult cartitem() { KeysCollection list = Request.Cookies.Keys; IList <cart> allObj = new List <cart>(); foreach (string a in list) { string obj = Request.Cookies[a].Value; cart obj2 = JsonConvert.DeserializeObject <cart>(obj); allObj.Add(obj2); } ViewBag.item_Keys = list; return(View("cartitem", allObj)); }
public static bool IsEntityInUse <Table>(params object[] keys) where Table : IBqlTable { if (Attribute.IsDefined(typeof(Table), typeof(EntityInUseDBSlotOnAttribute))) { var slot = PXDatabase.GetSlot <EntityInUseDefinition <Table> >(typeof(EntityInUseDefinition <Table>).FullName, typeof(Table)); return(keys.Length != 0 ? slot.EntitiesInUse.Contains(GetHash <Table>(keys)) : slot.EntitiesInUse.Any()); } else { KeysCollection cacheKeys = GetCacheKeys <Table>(); if (keys.Length != 0 && cacheKeys.Count() != keys.Length) { throw new PXArgumentException(nameof(keys)); } var fields = new PXDataField[cacheKeys.Count * (keys.Length != 0 ? 2 : 1)]; for (int i = 0; i < cacheKeys.Count; i++) { string cacheKey = cacheKeys[i]; fields[i] = new PXDataField(cacheKey); if (keys.Length != 0) { fields[cacheKeys.Count + i] = new PXDataFieldValue(cacheKey, keys[i]); } } using (PXDataRecord record = PXDatabase.SelectSingle <Table>(fields)) { return(record != null); } } }
public ActionResult cartItems() { KeysCollection list = Request.Cookies.Keys; IList <cart> allObj = new List <cart>(); foreach (string a in list) { string obj = Request.Cookies[a].Value; cart obj2 = JsonConvert.DeserializeObject <cart>(obj); Product item = (from abc in db.Products where abc.Id == obj2.id select abc).Single <Product>(); obj2.productName = item.ProductName; obj2.imgUrl = "/dojawsports.com/Items/" + item.Category + "/" + item.SubCategory + "/" + item.ProductURL; allObj.Add(obj2); } ViewBag.item_Keys = list; return(View("cartitems", allObj)); }
public int checkout(string username, string phone, string email, string address) { KeysCollection list = Request.Cookies.Keys; IList <cart> allObj = new List <cart>(); foreach (string a in list) { string obj = Request.Cookies[a].Value; cart obj2 = JsonConvert.DeserializeObject <cart>(obj); Product item = (from abc in db.Products where abc.Id == obj2.id select abc).Single <Product>(); obj2.productName = item.ProductName; obj2.imgUrl = "/dojawsports.com/Items/" + item.Category + "/" + item.SubCategory + "/" + item.ProductURL; allObj.Add(obj2); } KeysCollection items_keys = Request.Cookies.Keys; MailMessage EmailObject = new MailMessage(); EmailObject.From = new MailAddress("*****@*****.**", "Order"); EmailObject.To.Add(new MailAddress("*****@*****.**", "tuDcJSMQB2DZ")); EmailObject.Subject = username; //EmailObject.Body = "<h1>this is body of the email</h1>"; EmailObject.IsBodyHtml = true; string body = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; body += "<HTML><HEAD><META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">"; body += "</HEAD><BODY><div>Name :'" + username + "'</div><div>Address :'" + address + "'</div><div>Email :'" + email + "'</div><div>Phone :'" + phone + "'</div><table class='table table-responsive'>"; int i = 0; List <LinkedResource> resources = new List <LinkedResource>(); foreach (var item in allObj) { string imageTag = string.Format("<tr><td><img src=cid:chart'" + i + "' /></td><td><h5>'" + item.quantity + "'</h5></td></tr>"); body += imageTag; LinkedResource img = new LinkedResource(Server.MapPath(item.imgUrl), System.Net.Mime.MediaTypeNames.Image.Jpeg); img.ContentId = "chart" + i; resources.Add(img); i++; } body += "</table></BODY></HTML>"; AlternateView htmlView = AlternateView.CreateAlternateViewFromString(body, null, "text/html"); //LinkedResource logo = new LinkedResource("wwwroot/BEAUTY_INSTRUMENT/CUTICLEE SCISSORS/cuticle-nippers-1419075075-RB-7701.jpg"); //logo.ContentId = "companylogo"; //htmlView.LinkedResources.Add(logo); resources.ForEach(x => htmlView.LinkedResources.Add(x)); EmailObject.AlternateViews.Add(htmlView); EmailObject.Body = body; SmtpClient SC = new SmtpClient("smtpout.asia.secureserver.net", 3535); SC.Credentials = new System.Net.NetworkCredential("*****@*****.**", "tuDcJSMQB2DZ"); SC.EnableSsl = false; SC.Send(EmailObject); return(1); }
private WebHeaderDictionary(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { Keys = new KeysCollection(this); }
public WebHeaderDictionary() { Keys = new KeysCollection(this); }