예제 #1
0
        private bool SaveAllSetting()
        {
            int numberOfStation;
            int uniqueIdLength;

            try
            {
                numberOfStation = Convert.ToInt32(tb_NumberOfStation.Text);
                uniqueIdLength  = Convert.ToInt32(tb_UniqueIdentityLength.Text);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, @"Menyimpan Data Bermasalah", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(false);
            }

            try
            {
                _setting.SetNumberOfStation(numberOfStation);
                _setting.SetAdminPassword(tb_AdminPassword.Text);
                _setting.SetEnableTraceability(cb_EnableTraceability.Checked);
                _setting.SetUniqueIdLength(uniqueIdLength);
                _setting.SetDatabaseConnectionString(tb_DbConnectionString.Text);
                _setting.SetMachineSerialNumnber(tb_MachineSerialNumber.Text);
                _setting.SetPlcIpAddress(tb_PlcIpAddress.Text);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, @"Menyimpan Data Bermasalah", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(false);
            }
            return(true);
        }