예제 #1
0
 private void InitializeControlValues()
 {
     this.baudRateComboBox.Text = this.the_strBaudRate;
     this.dataBitsComboBox.Text = this.the_strDataBits;
     this.parityComboBox.Items.Clear();
     this.parityComboBox.Items.AddRange(Enum.GetNames(typeof(Parity)));
     this.parityComboBox.Text = this.the_strParity;
     this.stopBitsComboBox.Items.Clear();
     this.stopBitsComboBox.Items.AddRange(Enum.GetNames(typeof(StopBits)));
     this.stopBitsComboBox.Text = this.the_strStopBits;
     this.portNameComboBox.Items.Clear();
     string[] portNames = SerialPort.GetPortNames();
     for (int i = 0; i < portNames.Length; i++)
     {
         string item = portNames[i];
         this.portNameComboBox.Items.Add(item);
     }
     if (this.portNameComboBox.Items.Contains(this.the_strPortName))
     {
         this.portNameComboBox.Text = this.the_strPortName;
     }
     else
     {
         if (this.portNameComboBox.Items.Count > 0)
         {
             this.portNameComboBox.SelectedIndex = 0;
         }
         else
         {
             MyMsgBox.MsgErrorTitle("Không có Comport.\nHãy mở Comport và mở lại chương trình.", "Thông báo");
             base.Close();
         }
     }
 }
예제 #2
0
        private bool InsertCallDetail(string strRegion, string strRoom, string strBed)
        {
            bool result;

            try
            {
                this.strSQL = string.Concat(new object[]
                {
                    "INSERT INTO  [dbo].[CALL_DETAILS]([bed_id],[room_id],[region_id],[shift_id],[user_id],[start_call],[transaction_date]) VALUES(",
                    Convert.ToInt32(strBed),
                    ",",
                    Convert.ToInt32(strRoom),
                    ",",
                    Convert.ToInt32(strRegion),
                    ",",
                    clsUtl.SHIFT_ID,
                    ",",
                    clsUtl.USER_ID,
                    ", getdate(), getdate())"
                });
                Console.WriteLine(this.strSQL);
                this.provider.excuteNonQuery(this.strSQL);
                result = true;
            }
            catch (Exception ex)
            {
                MyMsgBox.MsgErrorTitle(ex.Message, "InsertCallDetail");
                result = false;
            }
            return(result);
        }