private static void JsonHandler() { string jsonFile = "C:\\Users\\admin\\Documents\\Visual Studio 2015\\Projects\\projectArduinoFirstTry\\medicine.json"; var readAllText = File.ReadAllText(jsonFile); JavaScriptSerializer ser = new JavaScriptSerializer(); _medicineList = ser.Deserialize <MedicineList>(readAllText); }
protected void addButton_Click(object sender, EventArgs e) { Medicine aMedicine = new Medicine(); aMedicine.NameOfMedicine = selectMedicineDropDownList.SelectedItem.ToString(); aMedicine.Quantity = int.Parse(sendMedicineQuantityTextBox.Text); MedicineList.Add(aMedicine); sendMedicineGridView.DataSource = MedicineList; sendMedicineGridView.DataBind(); }
public void MakeMedicineDetail(DNAStruct dnaStruct) { if (medicineList == null) { medicineList = GameObject.FindGameObjectWithTag("SceneManager").GetComponent <MedicineList>(); } medicineStruct = medicineList.GetMedicineData(dnaStruct); cartridgeName = (int)medicineStruct.medicineName; cartridgeInfo = medicineStruct.medicineInfo; spriteImg = medicineStruct.medicineSprite; }
public IActionResult addMedicine(MedicineList obj) { try { _repo.donateMedicine(obj); return(Ok()); } catch (Exception e) { return(NotFound(e.Message)); } }
private void GetDetails() { if (PreviousPage != null) { var searchBox = (TextBox)PreviousPage.FindControl("txt_search_med"); searchString = searchBox.Text; } else { searchString = ""; } System.Diagnostics.Debug.WriteLine(searchString); DataTable dtMedicineList = new DataTable("MedicineList"); DataTable dtCount = new DataTable("MedicineList"); page = Request.QueryString["page"] != null?int.Parse(Request.QueryString["page"]) : 1; int perPage = 10; using (SqlConnection con = new SqlConnection(connectionstring)) { SqlCommand cmd = new SqlCommand("SELECT * FROM MEDICINE_DB WHERE NAME LIKE @search + '%'"); cmd.Parameters.AddWithValue("search", searchString); cmd.Connection = con; con.Open(); using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { sda.Fill(dtMedicineList); } } //int totalCount = (int)dtCount.Rows[0][0]; //pagination = new Pagination(page, perPage, totalCount); //using (SqlConnection con = new SqlConnection(connectionstring)) //{ // SqlCommand cmd = new SqlCommand("SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY NAME) AS x FROM MEDICINE_DB) AS tbl WHERE tbl.x BETWEEN @low AND @high AND NAME LIKE @search"); // cmd.Parameters.AddWithValue("low", pagination.offset()); // cmd.Parameters.AddWithValue("high", pagination.offset() + perPage); // cmd.Parameters.AddWithValue("search", searchString); // //SqlCommand cmd = new SqlCommand("SELECT * FROM MEDICINE_DB"); // cmd.Connection = con; // con.Open(); // using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) // { // sda.Fill(dtMedicineList); // } //} //dtMedicineList = (DataTable)dtMedicineList.AsEnumerable().Skip(pagination.offset()).Take(perPage); MedicineList.DataSource = dtMedicineList; MedicineList.DataBind(); }
// Start is called before the first frame update protected override void Start() { base.Start(); medicineList = GameObject.FindGameObjectWithTag("SceneManager").GetComponent <MedicineList>(); IsMicrobe = false; if (medicineList.GivenNum == 0) { medicineStruct = medicineList.GetFirstMedicineData(); cartridgeName = (int)medicineStruct.medicineName; cartridgeInfo = medicineStruct.medicineInfo; spriteImg = medicineStruct.medicineSprite; } }
public MainWindow() { InitializeComponent(); InitializeSpeechRecognizer(); InitializeDeltaAngles(); try { AzureHandler.InitializeAzureStorage(); _medicineList = AzureHandler.ReadFromTable(); } catch (Exception) { JsonHandler(); } }
private void DeleteCommandFun(object obj) { if (SelectedItem == null) { return; } if (MessageBox.Show( "Вы точно хотите удалить запись?", "Подтверждение", MessageBoxButton.YesNo, MessageBoxImage.Question ) != MessageBoxResult.Yes) { return; } db.Medicines.Remove(SelectedItem); MedicineList.Remove(SelectedItem); db.SaveChanges(); }
private async void ImportFileIntoDatabase(object fileName) { FileStream fs = null; StreamReader sr = null; try { fs = File.Open((string)fileName, FileMode.Open); sr = new StreamReader(fs); string contents = sr.ReadToEnd(); string[] contentLines = contents.Split(new char[] { '\n' }); MedicineContext context = new MedicineContext(); if (ValidateFile(contentLines[0])) { for (int i = 1; i < contentLines.Length; i++) { string[] medicineInfos = contentLines[i].Split(','); Medicine obj = new Entities.Medicine { Id = medicineInfos[0], Name = medicineInfos[1], ManufacturingDate = DateTime.Parse(medicineInfos[2]), ExpirationDate = DateTime.Parse(medicineInfos[3]) }; MedicineList.Add(obj); await context.Medicines.InsertOneAsync(obj); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { fs.Close(); sr.Close(); } }
public static MedicineList ReadFromTable() { // Construct the query operation for all customer entities where PartitionKey="Smith". TableQuery<MedicineEntity> query = new TableQuery<MedicineEntity>();//.Where(/*TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "Smith")*/); MedicineList medicineList = new MedicineList(); // Print the fields for each customer. foreach (MedicineEntity entity in _table.ExecuteQuery(query)) { Medicine medicineToAdd = new Medicine(); medicineToAdd.Code = long.Parse(entity.RowKey); medicineToAdd.Name = entity.PartitionKey; medicineToAdd.DangersDesc = entity.DangersDesc; medicineToAdd.UserDesc = entity.UserDesc; medicineToAdd.Price = entity.Price; medicineToAdd.ImagePath = entity.ImagePath; medicineToAdd.Date = DateTime.Parse(entity.Date); medicineList.MedicineVal.Add(medicineToAdd); } return medicineList; }
private void medicineToolStripMenuItem_Click(object sender, EventArgs e) { MedicineList medicine = new MedicineList(); medicine.ShowDialog(); }
public void donateMedicine(MedicineList medicinelist) { _context.Add(medicinelist); _context.SaveChanges(); }
private static void JsonHandler() { string jsonFile = "C:\\Users\\admin\\Documents\\Visual Studio 2015\\Projects\\projectArduinoFirstTry\\medicine.json"; var readAllText = File.ReadAllText(jsonFile); JavaScriptSerializer ser = new JavaScriptSerializer(); _medicineList = ser.Deserialize<MedicineList>(readAllText); }