private void Treatment_Wizzard_Finish(object sender, EventArgs e) { int id = Assets.GetNewId("treatments"); if (id == -1) { MessageBox.Show(Access.ExplaindError()); return; } try { List <object> list = new List <object>() { id, Treatment_Name.Text, Treatment_Decription.Text, int.Parse(Treatment_Price.Text) }; if (Access.Execute(SQL_Queries.Insert("treatments", list))) { MessageBox.Show("טיפול חדש נכנס לטיפול"); Refresh_Screen(); } else { MessageBox.Show(Access.ExplaindError()); } } catch { } }
public static bool InsertCar() { bool execute = true; foreach(List<object>car in cars) execute &= Access.Execute(SQL_Queries.Insert("cars", car)); return execute; }
public static FidoReturnValues SQLFidoReturnValues(FidoReturnValues lFidoReturnValues, string sSrcIP, string sHostname) { //go to our sysmgmt data sources in the XML to get SQL queries and strings var sSQLSource = SQL_Queries.GetSqlSources(); var sLandeskSrcIP = String.Empty; foreach (var source in sSQLSource) { // ReSharper disable once RedundantAssignment var lQuery = new List <string>(); var lHostInfo = new List <string>(); string sNewSource = null; var sSplitSource = source.Split('-'); sNewSource = sSplitSource.Length > 1 ? sSplitSource[0] : source; switch (sNewSource) { case "landesk": sLandeskSrcIP = SourceLandesk(ref lFidoReturnValues, sSrcIP, sHostname, sNewSource, sLandeskSrcIP, source, lHostInfo); continue; case "jamf": //if nmap or ssh is null use IP SetHostInfo(sHostname, sSrcIP, source, lHostInfo); //if return has values assign to lFidoReturnValues if (lHostInfo[0] != "unknown") { if ((lFidoReturnValues.Landesk != null) && !String.IsNullOrEmpty(lFidoReturnValues.Landesk.Hostname)) { var LandeskDateTime = Convert.ToDateTime(lFidoReturnValues.Landesk.LastUpdate); var JamfDateTime = FromEpochTime(lHostInfo[3]); if (LandeskDateTime.ToUniversalTime() > JamfDateTime) { continue; } } lFidoReturnValues.Hostname = lHostInfo[1]; lFidoReturnValues.Username = lHostInfo[11]; if (lFidoReturnValues.Jamf == null) { lFidoReturnValues.Jamf = new JamfReturnValues(); } lFidoReturnValues.Jamf = Jamf2FidoValues.Convert(lFidoReturnValues, lHostInfo); } continue; default: continue; } } return(lFidoReturnValues); }
public static bool updateWorker() { Row columes = new Row( ); Condition con = new Condition("id", int.Parse(worker.GetColValue("id").ToString())); columes.AddColume(new Col("password", worker.GetColValue("password"))); return(Access.Execute(SQL_Queries.Update("workers", columes.GetColumes(), con))); }
public static bool InsertCar(List <object> values) { bool execute = Access.Execute(SQL_Queries.Insert("cars", values)); if (execute) { Refresh(); } return(execute); }
public static bool DeleteCar(int number) { bool execute = Access.Execute(SQL_Queries.Delete("cars", new Condition("car_number", number))); if (execute) { Refresh(); } return(execute); }
public static bool DeleteTreatment() { if (Selected_Treatment == -1) { return(false); } Condition condition = new Condition("id", int.Parse(GetValue("id"))); return(Access.Execute(SQL_Queries.Delete("treatments", condition))); }
public static bool UpdateTreatment(List <Col> values) { if (Selected_Treatment == -1) { return(false); } Condition condition = new Condition("id", int.Parse(GetValue("id"))); return(Access.Execute(SQL_Queries.Update("treatments", values, condition))); }
public bool remove_user() { try { bool execute = Access.Execute(SQL_Queries.Delete("people", new Condition("id", int.Parse(id)))); Assets.Refresh(); return(execute); } catch { return(false); } }
public static int GetNewId(string name) { List <Row> table = Access.getObjects(SQL_Queries.Select(name)); if (table != null) { try { return(int.Parse(table[table.Count - 1].GetColValue(0).ToString()) + 1); } catch (Exception err) { } } return(-1); }
public static void Exit(int id) { string query; foreach (Row row in Assets.shifts) { if (row.GetColValue("end_shift").ToString() == "not") { row.UpdateColume(new Col("end_shift", DateTime.Today.ToShortTimeString())); query = SQL_Queries.Update("shifts", row.GetColumes(), new Condition("shift", row.GetColValue("shift"))); Access.Execute(query); } } }
private static List <string> SetHostInfo(string sHostname, string sLandeskSrcIP, string source, List <string> lHostInfo) { List <string> lQuery; //if nmap or ssh is null if (String.IsNullOrEmpty(sHostname)) { lQuery = SQL_Queries.GetSqlConfigs(source); lHostInfo.AddRange(SQL_Queries.RunMSsqlQuery(lQuery, sLandeskSrcIP, null)); } else { lQuery = SQL_Queries.GetSqlConfigs(source); lHostInfo.AddRange(SQL_Queries.RunMSsqlQuery(lQuery, null, sHostname)); } return(lQuery); }
public static bool UpdateUser(List <Col> update) { bool execute = Access.Execute(SQL_Queries.Update("people", update, new Condition("id", user_id))); if (execute) { foreach (Col col in update) { if (col.GetField() == "id") { user_id = (int)(col.GetValue()); break; } } user.UpdateColume(update); GetUserInfo(); } return(execute); }
public static bool Enter(int id) { List <object> list = new List <object>() { getLastShift() + 1, id, DateTime.Today.ToShortDateString(), DateTime.Today.ToShortTimeString(), "not" }; string query = SQL_Queries.Insert("shifts", list); if (Access.Execute(query)) { Assets.Reload_Shifts(); return(true); } return(false); }
private void Worker_Register_Finish(object sender, EventArgs e) { if (Wizzard_Helper.inputValidator(Worker_Profile_Panel) && Wizzard_Helper.inputValidator(Worker_User_panel)) { try { List <object> profile = new List <object>() { int.Parse(Worker_Id.Text), Worker_fname.Text, Worker_lname.Text, Worker_Bdate.Value.ToShortDateString(), Worker_gender.Text, Worker_phone.Text, Worker_email.Text, }, user = new List <object>() { int.Parse(Worker_Id.Text), Worker_password.Text, Worker_Admin.Checked }; if (Access.Execute(SQL_Queries.Insert("people", profile)) && Access.Execute(SQL_Queries.Insert("workers", user))) { Refresh_Screen(); MessageBox.Show("inserted"); } else { MessageBox.Show(Access.ExplaindError()); Access.Execute(SQL_Queries.Delete("people", new Condition("id", int.Parse(Worker_Id.Text)))); } } catch { } } else { MessageBox.Show("אנא מלא את השדות החסרים"); } }
public static bool UpdateCar(List <Col> update, int number) { MessageBox.Show(SQL_Queries.Update("cars", update, new Condition("number", number))); bool execute = Access.Execute(SQL_Queries.Update("cars", update, new Condition("car_number", number))); if (execute) { foreach (Row row in cars) { if (row.GetColValue("car_number").ToString() == number.ToString()) { row.UpdateColume(update); break; } } Refresh(); } return(execute); }
public static void FilterOrders(List <CheckBox> boxes, List <object> values) { List <Condition> conditions = new List <Condition>(); List <Row> table = new List <Row>(); filter_Orders.Clear(); conditions.Add(new Condition("customer", user_id)); bool num = false; string value = ""; for (int i = 0; i < boxes.Count; i++) { if (boxes[i].Name != "recipt") { conditions.Add(Create_Condition(boxes[i], values[i])); } else { num = true; value = values[i].ToString(); } } if (num) { table = Access.getObjects(SQL_Queries.Select("orders", conditions, "and")); foreach (Row row in table) { if (row.GetColValue("id").ToString().Contains(value)) { filter_Orders.Add(row); } } } else { filter_Orders = Access.getObjects(SQL_Queries.Select("orders", conditions, "and")); } }
public static void Reload_Orders() { orders = Access.getObjects(SQL_Queries.Select("orders")); }
public static void Reload_Order_Treatments() { order_treatments = Access.getObjects(SQL_Queries.Select("order_treatment")); }
public static void Reload_Shifts() { shifts = Access.getObjects(SQL_Queries.Select("shifts")); }
public static void Reload_Manufactors() { manufactors = Access.getObjects(SQL_Queries.Select("manfuactors")); }
public static void Reload_Models() { models = Access.getObjects(SQL_Queries.Select("models")); }
public static void Reload_Treatments() { treatments = Access.getObjects(SQL_Queries.Select("treatments")); }
public static void Reload_Cars() { cars = Access.getObjects(SQL_Queries.Select("cars")); }
public static void Reload_Workers() { workers = Access.getObjects(SQL_Queries.Select("workers")); }
public static void Reload_People() { users = Access.getObjects(SQL_Queries.Select("people")); }
public static FidoReturnValues SQLFidoReturnValues(FidoReturnValues lFidoReturnValues, string sSrcIP, string sHostname) { //go to our sysmgmt data sources in the XML to get SQL queries and strings var sSQLSource = SQL_Queries.GetSqlSources(); var sLandeskSrcIP = String.Empty; foreach (var source in sSQLSource) { // ReSharper disable once RedundantAssignment var lQuery = new List <string>(); var lHostInfo = new List <string>(); string sNewSource = null; var sSplitSource = source.Split('-'); sNewSource = sSplitSource.Length > 1 ? sSplitSource[0] : source; switch (sNewSource) { case "landesk": //this is a hack needed to reformat the srcip if Landesk is used //because landesk stores IPs in 000.000.000.000 format Where each //octet needs 3 numbers. if ((sNewSource.ToLower() == "landesk") && (!String.IsNullOrEmpty(sSrcIP))) { sLandeskSrcIP = SysmgmtLandesk.FormatIP(sSrcIP); } //if nmap or ssh is null if (String.IsNullOrEmpty(sHostname)) { lQuery = SQL_Queries.GetSqlConfigs(source); lHostInfo.AddRange(SQL_Queries.RunMSsqlQuery(lQuery, sLandeskSrcIP, null)); } else { lQuery = SQL_Queries.GetSqlConfigs(source); lHostInfo.AddRange(SQL_Queries.RunMSsqlQuery(lQuery, null, sHostname)); } //if return has values assign to lFidoReturnValues if (lHostInfo[0] != "unknown") { lFidoReturnValues.Hostname = lHostInfo[0]; if (lFidoReturnValues.Landesk == null) { lFidoReturnValues.Landesk = new LandeskReturnValues(); } //format return from Landesk to Fido object lFidoReturnValues = Landesk2FidoValues.LandesklFidoValues(lFidoReturnValues, lHostInfo); //query Landesk to get more system information lFidoReturnValues = SysmgmtLandesk.GetHostOsInfo(lFidoReturnValues, lQuery[0]); //query to get total # of vulns for the machine lFidoReturnValues.Landesk.Patches = SysmgmtLandesk.GetVulns(lFidoReturnValues.Hostname, lQuery[0]); //query to get if Bit9 was installed\ if (lFidoReturnValues.Bit9 == null) { lFidoReturnValues.Bit9 = new Bit9ReturnValues(); } lFidoReturnValues.Bit9.IsBit9 = IsBit9Installed(); lFidoReturnValues = SysmgmtLandesk.GetBit9Status(lFidoReturnValues, lQuery[0]); if (lFidoReturnValues.Landesk.Bit9Running == null) { lFidoReturnValues.Landesk.Bit9Running = String.Empty; } if (lFidoReturnValues.Landesk.Bit9Version == null) { lFidoReturnValues.Landesk.Bit9Version = String.Empty; } } continue; case "jamf": //if nmap or ssh is null use IP if (String.IsNullOrEmpty(sHostname)) { lQuery = SQL_Queries.GetSqlConfigs(source); lHostInfo.AddRange(SQL_Queries.RunMysqlQuery(lQuery, sSrcIP, null)); } //if hostname is not null use IP instead else { lQuery = SQL_Queries.GetSqlConfigs(source); lHostInfo.AddRange(SQL_Queries.RunMysqlQuery(lQuery, null, sHostname)); } //if return has values assign to lFidoReturnValues if (lHostInfo[0] != "unknown") { if ((lFidoReturnValues.Landesk != null) && !String.IsNullOrEmpty(lFidoReturnValues.Landesk.Hostname)) { var LandeskDateTime = Convert.ToDateTime(lFidoReturnValues.Landesk.LastUpdate); var JamfDateTime = FromEpochTime(lHostInfo[3]); if (LandeskDateTime.ToUniversalTime() > JamfDateTime) { continue; } } lFidoReturnValues.Hostname = lHostInfo[1]; lFidoReturnValues.Username = lHostInfo[11]; if (lFidoReturnValues.Jamf == null) { lFidoReturnValues.Jamf = new JamfReturnValues(); } lFidoReturnValues.Jamf = Jamf2FidoValues.Convert(lFidoReturnValues, lHostInfo); } continue; default: continue; } } return(lFidoReturnValues); }
public static bool RemoveUser(int id) { return Access.Execute(SQL_Queries.Delete("people", new Condition("id",id))); }
public static bool InsertPerson(List<object> values) { return Access.Execute(SQL_Queries.Insert("people", values)); }
public static bool DeleteUser() { return(Access.Execute(SQL_Queries.Delete("people", new Condition("id", user_id)))); }