public obj_on_load sku_assigned(string serial) { var result = new obj_on_load(); MySqlCommand command = conn.CreateCommand(); conn.Open(); String cmdText = "SELECT * FROM rediscovery where serial='" + serial + "' order by time desc limit 1"; MySqlCommand cmd = new MySqlCommand(cmdText, conn); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { result.model = (reader["model"].ToString()); result.cpu = (reader["cpu"].ToString()); result.hdd = (reader["hdd"].ToString()); result.manu = (reader["brand"].ToString()); result.ram = (reader["ram"].ToString()); result.serial = (reader["serial"].ToString()); result.sku = (reader["pallet"].ToString()); result.ictag = (reader["ictag"].ToString()); result.pre_coa = (reader["pre_coa"].ToString()); } conn.Close(); return(result); }
public void report(obj_on_load asset, string wcoa, string ocoa, string station) { //collect all information and output as a single SQl entry to the database string screen = ""; if (station == "Station 1") { screen = MainModel.screen(); } else { screen = "NA"; } try { conn.Open(); String cmdText = "INSERT INTO production_log (pre_coa, time, wcoa, ocoa , Manufacture, Model, CPU , RAM , HDD , serial, channel, location,video_card,screen_size,ictags) VALUES ('" + asset.pre_coa + "','" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "','" + wcoa + "','" + ocoa + "','" + asset.manu + "','" + asset.model + "','" + asset.cpu + "','" + asset.ram + "MB','" + asset.hdd + "GB', '" + asset.serial + "','" + asset.sku + "','" + station + "','" + MainModel.video_card() + "','" + screen + "','" + asset.ictag + "') ON DUPLICATE KEY UPDATE time = '" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "', ictags = '" + asset.ictag + "',Manufacture = '" + asset.manu + "',pre_coa='" + asset.pre_coa + "',Model='" + asset.model + "',CPU ='" + asset.cpu + "',RAM = '" + asset.ram + "',HDD='" + asset.cpu + "',serial='" + asset.serial + "',channel = '" + asset.sku + "',location='" + station + "',video_card ='" + asset.video + "', screen_size = '" + asset.screen + "'"; MySqlCommand cmd = new MySqlCommand(cmdText, conn); cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { } }
protected virtual void RaisePropertyChanged(string propName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propName)); switch (propName) { case ("Oem_coa"): break; case ("Asset_assign"): break; case ("SKU_assigned"): break; case ("Selected_channel"): Next_wcoa = mysql_data.get_next_wcoa(Selected_channel, Selected_station); Next_ocoa = mysql_data.get_next_wcoa(Selected_channel, Selected_station); Wcoa_dropdown_name = mysql_data.wcoa_station_name(Selected_station); Ocoa_dropdown_name = mysql_data.ocoa_station_name(Selected_station); var result = mysql_data.get_data(Selected_channel, Wcoa_dropdown_name, Ocoa_dropdown_name); Wcoa_id = result.wcoa_id; Ocoa_id = result.ocoa_id; Wcoa = result.wcoa; Ocoa = result.ocoa; Wcoa_num = result.wcoa_count; Ocoa_num = result.ocoa_count; mysql_data.Query_cleanup(Wcoa, Ocoa); scripts.gen_preconfig(); Mar_enable = true; break; case ("Search_COA"): Search_coa_result = mysql_data.search_coa(Search_coa); break; case ("Selected_station"): Tab_enable = true; break; case "Db_select_item": switch (Db_select_item) { case ("Online DB"): db_source = "Online DB"; mysql_data.change_connection_string(db_source); Station_list.Clear(); Station_list = mysql_data.Station(); obj_onload = mysql_data.sku_assigned(serial); SKU_assigned = obj_onload.sku; Asset_assign = obj_onload.ictag; break; case ("Local DB"): db_source = "Local DB"; mysql_data.change_connection_string(db_source); Station_list.Clear(); Station_list = mysql_data.Station(); break; } break; } } }