private void btnSave_Click(object sender, EventArgs e) { MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult resultDialog = MessageBox.Show("ยืนยันการบันทึกข้อมูล ?", "message", buttons, MessageBoxIcon.Warning); if (resultDialog == DialogResult.No) { return; } CvSystemCommonProperty data = new CvSystemCommonProperty(); data.IP_ADDRESS = CommonClassLibraryGlobal.IP; data.NAME_ADDRESS = CommonClassLibraryGlobal.HOST_NAME; data.SYSTEM_ID = frmSystem.SYSTEM_ID; data.USER_CREATE = CommonClassLibraryGlobal.OPERATOR_ID; data.USER_UPDATE = CommonClassLibraryGlobal.OPERATOR_ID; foreach (Control toolBox in this.Controls) { if (toolBox is SettingSpec_Text_Value_Without_Panel) { SettingSpec_Text_Value_Without_Panel tool = (SettingSpec_Text_Value_Without_Panel)toolBox; if (!SettingSpec_Text_Value_Without_Panel.checkData(tool)) { return; } else { PropertyInfo prop = null; prop = data.GetType().GetProperty(toolBox.Name, BindingFlags.Public | BindingFlags.Instance); if (null != prop && prop.CanWrite) { prop.SetValue(data, tool.TextBoxValue); } else { CommonClassLibraryGlobal.showError("ไม่สามารถเก็บค่าตัวแปรได้ '" + toolBox.Name + "' กรุณาติดต่อโปรแกรมเมอร์"); return; } } } } if (_cvSystemCommonController.Insert(data)) { CommonClassLibraryGlobal.showSuccess("แก้ไขข้อมูลสำเร็จ"); return; } else { CommonClassLibraryGlobal.showSuccess("แก้ไขข้อมูลไม่สำเร็จ กรุณาลองใหม่อีกครั้ง"); return; } }
public string SearchBySystemId(CvSystemCommonProperty dataItem) { string sql = @"SELECT * FROM tableName where SYSTEM_ID = 'dataItem.SYSTEM_ID' AND INUSE = 1"; sql = sql.Replace("tableName", tableName); sql = sql.Replace("dataItem.SYSTEM_ID", dataItem.SYSTEM_ID); return(sql); }
public string Delete(CvSystemCommonProperty dataItem) { string sql = @" UPDATE tableName SET INUSE = 0 , USER_UPDATE = 'dataItem.USER_UPDATE' , LAST_DATE = NOW() WHERE SYSTEM_ID = 'dataItem.SYSTEM_ID' AND INUSE = 1 "; sql = sql.Replace("tableName", tableName); sql = sql.Replace("dataItem.SYSTEM_ID", dataItem.SYSTEM_ID); sql = sql.Replace("dataItem.USER_UPDATE", dataItem.USER_UPDATE); return(sql); }
private void setOldValue(CvSystemCommonProperty data) { foreach (Control toolBox in this.Controls) { if (toolBox is SettingSpec_Text_Value_Without_Panel) { SettingSpec_Text_Value_Without_Panel tool = (SettingSpec_Text_Value_Without_Panel)toolBox; tool.TextBoxValue = GetPropValue(data, tool.Name.ToString()).ToString(); //var propInfo = data.GetType().GetProperty(tool.Name); //if (propInfo != null) //{ // propInfo.SetValue(info, value, null); //} } } }
public bool Insert(CvSystemCommonProperty dataItem) { bool result = true; try { _resultData = _model.Insert(dataItem); if (_resultData.StatusOnDb == false) { MessageBox.Show(_resultData.MessageOnDb, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); result = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); result = false; } return(result); }
public List <CvSystemCommonProperty> SearchBySystemId(CvSystemCommonProperty dataItem) { List <CvSystemCommonProperty> listItem = new List <CvSystemCommonProperty>(); try { _resultData = _model.SearchBySystemId(dataItem); if (_resultData.StatusOnDb == true) { foreach (DataRow row in _resultData.ResultOnDb.Rows) { CvSystemCommonProperty productProperty = new CvSystemCommonProperty { ID = row["ID"].ToString(), SYSTEM_ID = row["SYSTEM_ID"].ToString(), OSA_GPIB_ADDRESS = row["OSA_GPIB_ADDRESS"].ToString(), DIO_COM_PORT = row["DIO_COM_PORT"].ToString(), RESIDUAL_COM_PORT = row["RESIDUAL_COM_PORT"].ToString(), OPHIR_OUTPUT_POWER_METER_ADDRESS = row["OPHIR_OUTPUT_POWER_METER_ADDRESS"].ToString(), OPHIR_FW_METER_ADDRESS = row["OPHIR_FW_METER_ADDRESS"].ToString(), OPHIR_BW_METER_ADDRESS = row["OPHIR_BW_METER_ADDRESS"].ToString(), OPHIR_CENTER_PORT_FW_TFB_METER_ADDRESS = row["OPHIR_CENTER_PORT_FW_TFB_METER_ADDRESS"].ToString(), GL840_SAFETY_PD_CHANNEL = row["GL840_SAFETY_PD_CHANNEL"].ToString(), GL840_COLD_PLATE_TEMP_CHANNEL = row["GL840_COLD_PLATE_TEMP_CHANNEL"].ToString(), GL840_MS_IN_TEMP_CHANNEL = row["GL840_MS_IN_TEMP_CHANNEL"].ToString(), GL840_BASEPLATE_TEMP_CHANNEL = row["GL840_BASEPLATE_TEMP_CHANNEL"].ToString(), GL840_MS_OUT_TEMP_CHANNEL = row["GL840_MS_OUT_TEMP_CHANNEL"].ToString(), GL840_CAVITY_PD_CHANNEL = row["GL840_CAVITY_PD_CHANNEL"].ToString(), SAFETY_SHUT_DOWN_THRESHOLD = row["SAFETY_SHUT_DOWN_THRESHOLD"].ToString(), SAFETY_OFFSET = row["SAFETY_OFFSET"].ToString(), SAFETY_MIN_PD_OUTPUT = row["SAFETY_MIN_PD_OUTPUT"].ToString(), SAFETY_MIN_OUTPUT_POWER = row["SAFETY_MIN_OUTPUT_POWER"].ToString(), SAFETY_OUTPUT_CHECK_TIME = row["SAFETY_OUTPUT_CHECK_TIME"].ToString(), SAFETY_MAX_COLDPLATE_TEMP = row["SAFETY_MAX_COLDPLATE_TEMP"].ToString(), OFFSET_SLOP_EFFICIENCY_RESONATOR = row["OFFSET_SLOP_EFFICIENCY_RESONATOR"].ToString(), OFFSET_SLOP_EFFICIENCY_THERMAL_SCREENING = row["OFFSET_SLOP_EFFICIENCY_THERMAL_SCREENING"].ToString(), OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_1 = row["OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_1"].ToString(), OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_2 = row["OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_2"].ToString(), OFFSET_SLOP_EFFICIENCY_MONITOR_CAL = row["OFFSET_SLOP_EFFICIENCY_MONITOR_CAL"].ToString(), OFFSET_SLOP_EFFICIENCY_POST_BURNIN = row["OFFSET_SLOP_EFFICIENCY_POST_BURNIN"].ToString(), DESCRIPTION = row["DESCRIPTION"].ToString(), LAST_DATE = row["LAST_DATE"].ToString(), USER_UPDATE = row["USER_UPDATE"].ToString(), CREATE_DATE = row["CREATE_DATE"].ToString(), IP_ADDRESS = row["IP_ADDRESS"].ToString(), NAME_ADDRESS = row["NAME_ADDRESS"].ToString(), INUSE = row["INUSE"].ToString(), USER_CREATE = row["USER_CREATE"].ToString(), }; listItem.Add(productProperty); } } else { MessageBox.Show(_resultData.MessageOnDb, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(listItem); }
public OutputOnDbProperty SearchBySystemId(CvSystemCommonProperty dataItem) { _resultData = _service.SearchBySystemId(dataItem); return(_resultData); }
public OutputOnDbProperty Insert(CvSystemCommonProperty dataItem) { _resultData = _service.Insert(dataItem); return(_resultData); }
public string Insert(CvSystemCommonProperty dataItem) { string sql = @"INSERT INTO tableName ( ID , SYSTEM_ID , OSA_GPIB_ADDRESS , DIO_COM_PORT , RESIDUAL_COM_PORT , OPHIR_OUTPUT_POWER_METER_ADDRESS , OPHIR_FW_METER_ADDRESS , OPHIR_BW_METER_ADDRESS , OPHIR_CENTER_PORT_FW_TFB_METER_ADDRESS , GL840_SAFETY_PD_CHANNEL , GL840_COLD_PLATE_TEMP_CHANNEL , GL840_MS_IN_TEMP_CHANNEL , GL840_BASEPLATE_TEMP_CHANNEL , GL840_MS_OUT_TEMP_CHANNEL , GL840_CAVITY_PD_CHANNEL , SAFETY_SHUT_DOWN_THRESHOLD , SAFETY_OFFSET , SAFETY_MIN_PD_OUTPUT , SAFETY_MIN_OUTPUT_POWER , SAFETY_OUTPUT_CHECK_TIME , SAFETY_MAX_COLDPLATE_TEMP , OFFSET_SLOP_EFFICIENCY_RESONATOR , OFFSET_SLOP_EFFICIENCY_THERMAL_SCREENING , OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_1 , OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_2 , OFFSET_SLOP_EFFICIENCY_MONITOR_CAL , OFFSET_SLOP_EFFICIENCY_POST_BURNIN , DESCRIPTION , IP_ADDRESS , NAME_ADDRESS , INUSE , USER_CREATE ) ( SELECT 1 + coalesce((SELECT max(Id) FROM tableName), 0) , 'dataItem.SYSTEM_ID' , 'dataItem.OSA_GPIB_ADDRESS' , 'dataItem.DIO_COM_PORT' , 'dataItem.RESIDUAL_COM_PORT' , 'dataItem.OPHIR_OUTPUT_POWER_METER_ADDRESS' , 'dataItem.OPHIR_FW_METER_ADDRESS' , 'dataItem.OPHIR_BW_METER_ADDRESS' , 'dataItem.OPHIR_CENTER_PORT_FW_TFB_METER_ADDRESS' , 'dataItem.GL840_SAFETY_PD_CHANNEL' , 'dataItem.GL840_COLD_PLATE_TEMP_CHANNEL' , 'dataItem.GL840_MS_IN_TEMP_CHANNEL' , 'dataItem.GL840_BASEPLATE_TEMP_CHANNEL' , 'dataItem.GL840_MS_OUT_TEMP_CHANNEL' , 'dataItem.GL840_CAVITY_PD_CHANNEL' , 'dataItem.SAFETY_SHUT_DOWN_THRESHOLD' , 'dataItem.SAFETY_OFFSET' , 'dataItem.SAFETY_MIN_PD_OUTPUT' , 'dataItem.SAFETY_MIN_OUTPUT_POWER' , 'dataItem.SAFETY_OUTPUT_CHECK_TIME' , 'dataItem.SAFETY_MAX_COLDPLATE_TEMP' , 'dataItem.OFFSET_SLOP_EFFICIENCY_RESONATOR' , 'dataItem.OFFSET_SLOP_EFFICIENCY_THERMAL_SCREENING' , 'dataItem.OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_1' , 'dataItem.OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_2' , 'dataItem.OFFSET_SLOP_EFFICIENCY_MONITOR_CAL' , 'dataItem.OFFSET_SLOP_EFFICIENCY_POST_BURNIN' , 'dataItem.DESCRIPTION' , 'dataItem.IP_ADDRESS' , 'dataItem.NAME_ADDRESS' , 1 , 'dataItem.USER_CREATE' )"; sql = sql.Replace("tableName", tableName); sql = sql.Replace("dataItem.SYSTEM_ID", dataItem.SYSTEM_ID); sql = sql.Replace("dataItem.OSA_GPIB_ADDRESS", dataItem.OSA_GPIB_ADDRESS); sql = sql.Replace("dataItem.DIO_COM_PORT", dataItem.DIO_COM_PORT); sql = sql.Replace("dataItem.RESIDUAL_COM_PORT", dataItem.RESIDUAL_COM_PORT); sql = sql.Replace("dataItem.OPHIR_OUTPUT_POWER_METER_ADDRESS", dataItem.OPHIR_OUTPUT_POWER_METER_ADDRESS); sql = sql.Replace("dataItem.OPHIR_FW_METER_ADDRESS", dataItem.OPHIR_FW_METER_ADDRESS); sql = sql.Replace("dataItem.OPHIR_BW_METER_ADDRESS", dataItem.OPHIR_BW_METER_ADDRESS); sql = sql.Replace("dataItem.OPHIR_CENTER_PORT_FW_TFB_METER_ADDRESS", dataItem.OPHIR_CENTER_PORT_FW_TFB_METER_ADDRESS); sql = sql.Replace("dataItem.GL840_SAFETY_PD_CHANNEL", dataItem.GL840_SAFETY_PD_CHANNEL); sql = sql.Replace("dataItem.GL840_COLD_PLATE_TEMP_CHANNEL", dataItem.GL840_COLD_PLATE_TEMP_CHANNEL); sql = sql.Replace("dataItem.GL840_MS_IN_TEMP_CHANNEL", dataItem.GL840_MS_IN_TEMP_CHANNEL); sql = sql.Replace("dataItem.GL840_BASEPLATE_TEMP_CHANNEL", dataItem.GL840_BASEPLATE_TEMP_CHANNEL); sql = sql.Replace("dataItem.GL840_MS_OUT_TEMP_CHANNEL", dataItem.GL840_MS_OUT_TEMP_CHANNEL); sql = sql.Replace("dataItem.GL840_CAVITY_PD_CHANNEL", dataItem.GL840_CAVITY_PD_CHANNEL); sql = sql.Replace("dataItem.SAFETY_SHUT_DOWN_THRESHOLD", dataItem.SAFETY_SHUT_DOWN_THRESHOLD); sql = sql.Replace("dataItem.SAFETY_OFFSET", dataItem.SAFETY_OFFSET); sql = sql.Replace("dataItem.SAFETY_MIN_PD_OUTPUT", dataItem.SAFETY_MIN_PD_OUTPUT); sql = sql.Replace("dataItem.SAFETY_MIN_OUTPUT_POWER", dataItem.SAFETY_MIN_OUTPUT_POWER); sql = sql.Replace("dataItem.SAFETY_OUTPUT_CHECK_TIME", dataItem.SAFETY_OUTPUT_CHECK_TIME); sql = sql.Replace("dataItem.SAFETY_MAX_COLDPLATE_TEMP", dataItem.SAFETY_MAX_COLDPLATE_TEMP); sql = sql.Replace("dataItem.OFFSET_SLOP_EFFICIENCY_RESONATOR", dataItem.OFFSET_SLOP_EFFICIENCY_RESONATOR); sql = sql.Replace("dataItem.OFFSET_SLOP_EFFICIENCY_THERMAL_SCREENING", dataItem.OFFSET_SLOP_EFFICIENCY_THERMAL_SCREENING); sql = sql.Replace("dataItem.OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_1", dataItem.OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_1); sql = sql.Replace("dataItem.OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_2", dataItem.OFFSET_SLOP_EFFICIENCY_PRE_BURNIN_2); sql = sql.Replace("dataItem.OFFSET_SLOP_EFFICIENCY_MONITOR_CAL", dataItem.OFFSET_SLOP_EFFICIENCY_MONITOR_CAL); sql = sql.Replace("dataItem.OFFSET_SLOP_EFFICIENCY_POST_BURNIN", dataItem.OFFSET_SLOP_EFFICIENCY_POST_BURNIN); sql = sql.Replace("dataItem.DESCRIPTION", dataItem.DESCRIPTION); sql = sql.Replace("dataItem.LAST_DATE", dataItem.LAST_DATE); sql = sql.Replace("dataItem.USER_UPDATE", dataItem.USER_UPDATE); sql = sql.Replace("dataItem.CREATE_DATE", dataItem.CREATE_DATE); sql = sql.Replace("dataItem.IP_ADDRESS", dataItem.IP_ADDRESS); sql = sql.Replace("dataItem.NAME_ADDRESS", dataItem.NAME_ADDRESS); sql = sql.Replace("dataItem.INUSE", dataItem.INUSE); sql = sql.Replace("dataItem.USER_CREATE", dataItem.USER_CREATE); return(sql); }