Exemplo n.º 1
0
 public void StopControlling()
 {
     if (Controlling != null)
     {
         Controlling.StopBeingControlled();
     }
     Controlling = null;
 }
Exemplo n.º 2
0
        private void FormCodeSetting_Load(object sender, EventArgs e)
        {
            string    strSql = string.Empty;
            DataTable dtTemp;
            Dictionary <string, object> keyValues = new Dictionary <string, object>();
            Controlling controlling = new Controlling();


            try
            {
                dtTemp = new DataTable();

                strSql = "SELECT list_type, list_id, CONCAT(list_name, ' - ', list_name_en) name, list_name, list_name_en, list_value, sort_sequence, active " +
                         "FROM config_list_item  " +
                         "WHERE list_type in ('VENDOR_CODE', 'DEVICE_TYPE') " +
                         "AND active = @active " +
                         "AND list_id <> @list_id " +
                         "ORDER BY sort_sequence ASC ";

                keyValues.Add("@active", "Y");
                keyValues.Add("@list_id", "NA");

                dtTemp = dBUtil.GetDataTable(strSql, keyValues);


                if (dtTemp.Rows.Count > 0)
                {
                    controlling.ListBox_ItemChange(ref lsbCodeConditionVendorCode, dtTemp.Select("list_type = 'VENDOR_CODE'"), "name", "list_value");
                    lsbCodeConditionVendorCode.SelectedIndex = -1;

                    controlling.ListBox_ItemChange(ref lsbCodeConditionDeviceType, dtTemp.Select("list_type = 'DEVICE_TYPE'"), "name", "list_value");
                    lsbCodeConditionDeviceType.SelectedIndex = -1;
                }
                else
                {
                    MessageBox.Show("list_item : VENDOR_CODE and DEVICE_TYPE does not exist.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }