private void setToDatabase(int i, double new_val, double old_val, string updateVar) { if (new_val != old_val) { PublicMehotd.SetDataToDatabase(updateVar, new_val.ToString()); } }
private void checkChange(string type, string var, string val) { try { if (Varibale.zarin[var + "_" + type] != val) { sendLogChangeData(type, var, Varibale.zarin[var + "_" + type], val); PublicMehotd.SetDataToDatabase(var + "_" + type, val); Varibale.zarin[var + "_" + type] = val; zeroSet = true; } } catch (Exception ex) { log_system.saveLogSystem(ex, "zarin check change"); } }
public static void getShostesho() { try { string x = PLC.Read("010108C80002", "shostesho"); //sample return :010101C 9 34 // shostesho mikonan 9 char[] strarray = x.ToCharArray(); string typenumber = strarray[7].ToString() + strarray[8].ToString(); int value = Convert.ToInt16(PublicMehotd.convertHextoInt(typenumber)); string binary = Convert.ToString(value, 2); char[] binaryArray = binary.ToCharArray(); if (binary[6] == '0') { PublicMehotd.SetDataToDatabase("shostesho_bad", "0"); } else { PublicMehotd.SetDataToDatabase("shostesho_bad", "1"); } if (binary[7] == '0') { PublicMehotd.SetDataToDatabase("shostesho_ghabl", "0"); } else { PublicMehotd.SetDataToDatabase("shostesho_ghabl", "1"); } //if(typenumber == '') } catch (Exception ex) { //MessageBox.Show(ex.Message); log_system.saveLogSystem(ex, "shostesho"); } }