public int PutOpenFuelSale(int num, [FromBody] OFS value) { try { // Закрытый доступ HttpContext.Current.Application.Lock(); if (num > 0 && num < 30) { HttpContext.Current.Application["id_gun_" + num.ToString()] = value.id; } if (num > 29 && num < 32) { HttpContext.Current.Application["id_ns_" + (num - 29).ToString()] = value.id; HttpContext.Current.Application["dose_ns_" + (num - 29).ToString()] = value.dose; HttpContext.Current.Application["counter_ns_" + (num - 29).ToString()] = value.counter; } // Снять закрытый доступ HttpContext.Current.Application.UnLock(); return(value.id); } catch (Exception e) { String.Format("Ошибка выполнения метода API:PutOpenFuelSale(num={0}, value={1})", num, value).SaveError(e); return(-1); } }
private void ShowActiveOrders() { foreach (OrderFromSupplier OFS in Program.ordersFromSuppliers) { if (Convert.ToString(OFS.getOrderStatus()).Equals("UnderTreatment")) { dataGridView1.Rows.Add(OFS.getID(), OFS.getOrderSupplier().get_supplierName(), OFS.getDateOfOrder(), OFS.getTotalPrice()); } } }
private void LOFSF_CheckedChanged(object sender, EventArgs e) { PwLib.Config.SetBool("LocalOffsets", LOFSF.Checked); OFS.Init(); }
public IHttpActionResult GetOpenFuelSale() { try { List <OFS> list = new List <OFS>(); // Закрытый доступ HttpContext.Current.Application.Lock(); // пистолеты for (int i = 1; i <= 29; i++) { OFS new_ofs = new OFS() { num = i, id = 0, dose = 0, counter = 0 }; string key = "id_gun_" + i.ToString(); if (HttpContext.Current.Application[key] != null) { int id = (int)(object)HttpContext.Current.Application[key]; new_ofs.id = id; } list.Add(new_ofs); } // наливные стояки for (int i = 1; i <= 3; i++) { OFS new_ofs = new OFS() { num = i + 29, id = 0, dose = 0, counter = 0 }; if (HttpContext.Current.Application["id_ns_" + i.ToString()] != null) { int id = (int)(object)HttpContext.Current.Application["id_ns_" + i.ToString()]; new_ofs.id = id; } if (HttpContext.Current.Application["dose_ns_" + i.ToString()] != null) { int dose = (int)(object)HttpContext.Current.Application["dose_ns_" + i.ToString()]; new_ofs.dose = dose; } if (HttpContext.Current.Application["counter_ns_" + i.ToString()] != null) { int counter = (int)(object)HttpContext.Current.Application["counter_ns_" + i.ToString()]; new_ofs.counter = counter; } list.Add(new_ofs); } // Снять закрытый доступ HttpContext.Current.Application.UnLock(); return(Ok(list)); } catch (Exception e) { String.Format("Ошибка выполнения метода API:GetOpenFuelSale()").SaveError(e); return(NotFound()); } }