Exemple #1
0
 private void Button1_Click(System.Object sender, System.EventArgs e)
 {
     if (!(NumericUpDown1.Value > 0))
     {
         MessageBox.Show("数量不能小于或等于0");
         NumericUpDown1.Focus();
         NumericUpDown1.Select(0, NumericUpDown1.Text.Length);
         return;
     }
     this.DialogResult = DialogResult.OK;
 }
Exemple #2
0
        private void frmFreeDiscount_Load(System.Object sender, System.EventArgs e)
        {
            NumericUpDown1.Select(0, NumericUpDown1.Text.Length);
            string DscntOnDscnt = rms_var.GetSysSetup("DiscountOnDiscount"); //允许折上折

            if (DscntOnDscnt == "1")                                         //允许折上折
            {
                Label4.Text = "后台允许优惠菜品特价菜品折上折";
            }
            else
            {
                Label4.ForeColor = Color.Red;
                Label4.Text      = "后台不允许优惠菜品特价菜品折上折";
            }
            string fixcostrtn = rms_var.FixCost();

            if (fixcostrtn == "0")
            {
                Label5.Text = "支付金额不抹零、不四舍五入";
            }
            else if (fixcostrtn == "1")
            {
                Label5.Text = "支付金额抹去角分";
            }
            else if (fixcostrtn == "2")
            {
                Label5.Text = "支付金额四舍五入到元";
            }
        }
 private void Button1_Click(System.Object sender, System.EventArgs e)
 {
     if (NumericUpDown1.Value <= 0)
     {
         MessageBox.Show("数量不能为 0");
         NumericUpDown1.Focus();
         NumericUpDown1.Select(0, NumericUpDown1.Text.Length);
     }
     else
     {
         if (NumericUpDown2.Value == 0)
         {
             NumericUpDown2.Value = NumericUpDown3.Value / NumericUpDown1.Value;
         }
         if (NumericUpDown3.Value == 0)
         {
             NumericUpDown3.Value = NumericUpDown1.Value * NumericUpDown2.Value;
         }
         this.DialogResult = DialogResult.OK;
     }
 }
        public static int ShowNumericDialog(string text, string caption)
        {
            var prompt = new Form()
            {
                FormBorderStyle = FormBorderStyle.FixedDialog,
                MinimizeBox = false,
                MaximizeBox = false,
                Width = 160,
                Height = 130,
                Text = caption,
                StartPosition = FormStartPosition.CenterScreen,
            };

            var cancel = new Button();
            cancel.Click += (sender, e) => prompt.Close();
            prompt.CancelButton = cancel;

            var textLabel = new Label()
            {
                Top = 10,
                Text = text,
                TextAlign = ContentAlignment.MiddleCenter,
                AutoSize = false,
                Width = prompt.Width
            };

            var textBox = new NumericUpDown() { Left = 20, Top = 40, Width = 120, Height = 80, Text = "5" };
            var confirmation = new Button() { Text = "Ok", Left = 30, Top = 70, Width = 100, DialogResult = DialogResult.OK };
            confirmation.Click += (sender, e) => { prompt.Close(); };

            prompt.Controls.Add(textBox);
            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(textLabel);
            prompt.AcceptButton = confirmation;

            textBox.Select(0, textBox.Text.Length);

            if (prompt.ShowDialog() == DialogResult.OK)
            {
                int inputValue;
                if (int.TryParse(textBox.Text, out inputValue))
                {
                    return inputValue;
                }
            }
            return -1;
        }
 private void NumericUpDown3_Enter(object sender, System.EventArgs e)
 {
     NumericUpDown3.Select(0, NumericUpDown3.Text.Length);
 }
Exemple #6
0
 private void frmCardSupply_Load(System.Object sender, System.EventArgs e)
 {
     NumericUpDown1.Select(0, NumericUpDown1.Text.Length);
 }
 private static void SelectValueOnFocus(NumericUpDown control)
 {
     control.Select(0, control.Text.Length);
 }
Exemple #8
0
        private void ShowInlineFormLeaveList()
        {
            this.FormEditItem();
            CustomTimePicker inline_from_time = new CustomTimePicker();
            inline_from_time.Name = "inline_from_time";
            inline_from_time.Read_Only = false;
            this.dgvLeaveList.Parent.Controls.Add(inline_from_time);

            CustomTimePicker inline_to_time = new CustomTimePicker();
            inline_to_time.Name = "inline_to_time";
            inline_to_time.Read_Only = false;
            this.dgvLeaveList.Parent.Controls.Add(inline_to_time);

            CustomComboBox inline_status = new CustomComboBox();
            inline_status.Name = "inline_status";
            inline_status.Read_Only = false;
            inline_status.BorderStyle = BorderStyle.None;
            inline_status.AddItem(new ComboboxItem("WAIT", (int)CustomDateEvent.EVENT_STATUS.WAIT_FOR_CONFIRM, "WAIT"));
            inline_status.AddItem(new ComboboxItem("CONFIRMED", (int)CustomDateEvent.EVENT_STATUS.CONFIRMED, "CONFIRMED"));
            inline_status.AddItem(new ComboboxItem("CANCELED", (int)CustomDateEvent.EVENT_STATUS.CANCELED, "CANCELED"));
            this.dgvLeaveList.Parent.Controls.Add(inline_status);

            CustomTextBox inline_customer = new CustomTextBox();
            inline_customer.Name = "inline_customer";
            inline_customer.Read_Only = false;
            inline_customer.BorderStyle = BorderStyle.None;
            inline_customer.MaxChar = 40;
            this.dgvLeaveList.Parent.Controls.Add(inline_customer);

            CustomComboBox inline_medcert = new CustomComboBox();
            inline_medcert.Name = "inline_medcert";
            inline_medcert.Read_Only = false;
            inline_medcert.BorderStyle = BorderStyle.None;
            inline_medcert.AddItem(new ComboboxItem("N/A (ไม่ระบุ)", 9, "X"));
            inline_medcert.AddItem(new ComboboxItem("ไม่มีใบรับรองแพทย์", 0, "N"));
            inline_medcert.AddItem(new ComboboxItem("มีใบรับรองแพทย์", 1, "Y"));
            this.dgvLeaveList.Parent.Controls.Add(inline_medcert);

            NumericUpDown inline_fine = new NumericUpDown();
            inline_fine.Name = "inline_fine";
            inline_fine.Font = new Font("tahoma", 9.75f);
            inline_fine.Maximum = 1000;
            inline_fine.Minimum = 0;
            inline_fine.BorderStyle = BorderStyle.None;
            inline_fine.TextAlign = HorizontalAlignment.Right;
            inline_fine.GotFocus += delegate
            {
                inline_fine.Select(0, inline_fine.Text.Length);
            };
            this.dgvLeaveList.Parent.Controls.Add(inline_fine);

            this.SetPositionFormLeaveList();
            this.dgvAbsentSummary.Enabled = false;
            this.dgvLeaveList.Enabled = false;
            this.dgvLeaveList.SendToBack();
            inline_from_time.BringToFront();
            inline_to_time.BringToFront();
            inline_status.BringToFront();
            inline_customer.BringToFront();
            inline_medcert.BringToFront();
            inline_fine.BringToFront();

            if (this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag is EventCalendar)
            {
                string[] from = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).from_time.Split(':');
                inline_from_time.Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), 0);
                string[] to = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).to_time.Split(':');
                inline_to_time.Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), 0);
                inline_status.comboBox1.SelectedItem = inline_status.comboBox1.Items.Cast<ComboboxItem>().Where(i => i.int_value == ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).status).First<ComboboxItem>();
                inline_customer.Texts = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).customer;
                inline_medcert.comboBox1.SelectedItem = inline_medcert.comboBox1.Items.Cast<ComboboxItem>().Where(i => i.string_value == ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).med_cert).First<ComboboxItem>();
                inline_fine.Value = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).fine;
            }
        }
Exemple #9
0
 private void opacityUpDown_Enter(object sender, System.EventArgs e)
 {
     opacityUpDown.Select(0, opacityUpDown.Text.Length);
 }
 protected override void OnLoad(EventArgs e)
 {
     amount1UpDown.Select();
     amount1UpDown.Select(0, amount1UpDown.Text.Length);
     base.OnLoad(e);
 }
Exemple #11
0
 private void AddFood_Load(System.Object sender, System.EventArgs e)
 {
     LoadFoodOperandi();
     LoadFoodTaste();
     numFoodQuantity.Select(0, numFoodQuantity.Text.Length);
 }
Exemple #12
0
 private void prepareSeasonNrControl(MediaFile someCandidate, NumericUpDown seasonNrControl)
 {
     // FIXME: Can't you set this just once?
     seasonNrControl.Minimum = 1;
     TvShow titleCollection = TvShowManager.Instance.GetTvShow(someCandidate.Showname);
     if (titleCollection != null) {
         seasonNrControl.Maximum = titleCollection.FindMaxSeason();
     }
     seasonNrControl.Select(0, seasonNrControl.Text.Length);
 }
Exemple #13
0
 private void frmAddSuitFoodQty_Load(System.Object sender, System.EventArgs e)
 {
     NumericUpDown1.Select(0, NumericUpDown1.Text.Length);
 }
Exemple #14
0
 //按TAB 时自动全选
 private void SelectAll(NumericUpDown numericUpDown)
 {
     numericUpDown.Select(0, numericUpDown.Value.ToString().Length);
 }
Exemple #15
0
 private void Button1_Click(System.Object sender, System.EventArgs e)
 {
     if (frmmode == 0)             //加单
     {
         if (TextBox1.Text.Trim() == "")
         {
             MessageBox.Show("单据号不能为空!");
             TextBox1.Focus();
             TextBox1.SelectAll();
         }
         else                 //返回单据类型编码
         {
             //检测服务员是否存在()
             if (rms_var.EmpExists(TextBox2.Text))
             {
                 CurrentBillTypeCode = rms_var.GetBillTypeCode(ComboBox1.Text);
                 if (CurrentBillTypeCode != "")
                 {
                     this.DialogResult = DialogResult.OK;
                 }
                 else
                 {
                     CurrentBillTypeCode = "";
                     MessageBox.Show("没有选择单据类型,或者单据类型不存在!");
                     ComboBox1.SelectedIndex = 0;
                     ComboBox1.Focus();
                 }
             }
             else
             {
                 MessageBox.Show("服务员不存在");
                 TextBox2.Focus();
                 TextBox2.SelectAll();
             }
         }
     }
     else             //开台、新建单据
     {
         if (!(NumericUpDown1.Value > 0))
         {
             MessageBox.Show("开台人数不能小于或等于0");
             NumericUpDown1.Focus();
             NumericUpDown1.Select(0, NumericUpDown1.Text.Length);
             return;
         }
         if (TextBox1.Text.Trim() == "")
         {
             MessageBox.Show("单据号不能为空!");
             TextBox1.Focus();
             TextBox1.SelectAll();
         }
         else                 //返回单据类型编码
         {
             //检测服务员是否存在()
             if (rms_var.EmpExists(TextBox2.Text))
             {
                 CurrentBillTypeCode = rms_var.GetBillTypeCode(ComboBox1.Text);
                 if (CurrentBillTypeCode != "")
                 {
                     this.DialogResult = DialogResult.OK;
                 }
                 else
                 {
                     CurrentBillTypeCode = "";
                     MessageBox.Show("没有选择单据类型,或者单据类型不存在!");
                     ComboBox1.SelectedIndex = 0;
                     ComboBox1.Focus();
                 }
             }
             else
             {
                 MessageBox.Show("服务员不存在");
                 TextBox2.Focus();
                 TextBox2.SelectAll();
             }
         }
     }
 }
    OnInvalidNumericUpDown
    (
        NumericUpDown oNumericUpDown,
        String sErrorMessage
    )
    {
        Debug.Assert(oNumericUpDown != null);
        Debug.Assert(sErrorMessage != null && sErrorMessage != "");

        OnInvalidControl(oNumericUpDown, sErrorMessage);
        oNumericUpDown.Select(0, oNumericUpDown.Text.Length);

        return (false);
    }
 private void ThresholdUpDown_Enter(object sender, System.EventArgs e)
 {
     thresholdUpDown.Select(0, thresholdUpDown.Text.Length);
 }
 private void amount2UpDown_Enter(object sender, System.EventArgs e)
 {
     amount2UpDown.Select(0, amount2UpDown.Text.Length);
 }
 private void DitherUpDown_Enter(object sender, EventArgs e)
 {
     ditherUpDown.Select(0, thresholdUpDown.Text.Length);
 }
Exemple #20
0
 private void FormGoTo_Activated(object sender, System.EventArgs e)
 {
     nup.Focus();
     nup.Select(0, nup.Value.ToString().Length);
 }
 private void QualityUpDown_Enter(object sender, System.EventArgs e)
 {
     qualityUpDown.Select(0, qualityUpDown.Text.Length);
 }