Ejemplo n.º 1
0
        void ShowDateEdit(CellValue value, Rectangle bounds)
        {
            dateEdit.EditValue = value.DateTimeValue;

            dateEdit.Parent  = spreadsheetControl1;
            dateEdit.Bounds  = bounds;
            dateEdit.Visible = true;
            dateEdit.Focus();
        }
Ejemplo n.º 2
0
        private bool IsFormValidated()
        {
            //Check control empty
            if (this.lueWarehouse.EditValue == null)
            {
                this.dxErrorProvider1.SetError(this.lueWarehouse, "Warehouse can't be Empty", ErrorType.Warning);
                this.lueWarehouse.Focus();
                return(false);
            }

            if (this.dxErrorProvider1.HasErrors)
            {
                string controlType = this.dxErrorProvider1.GetControlsWithError()[0].GetType().ToString();
                switch (controlType)
                {
                case "DevExpress.XtraEditors.TextEdit":

                    TextEdit tError = (TextEdit)this.dxErrorProvider1.GetControlsWithError()[0];
                    tError.Focus();
                    break;

                case "DevExpress.XtraEditors.DateEdit":
                    XtraMessageBox.Show(this, "Plase Input Valid value", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    DateEdit dError = (DateEdit)this.dxErrorProvider1.GetControlsWithError()[0];
                    dError.Focus();
                    break;

                case "DevExpress.XtraEditors.LookUpEdit":
                    LookUpEdit lError = (LookUpEdit)this.dxErrorProvider1.GetControlsWithError()[0];
                    lError.Focus();
                    break;

                default:
                    break;
                }


                XtraMessageBox.Show(this, "Plase Input Valid value", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);



                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 3
0
        private void CheckControl(object control)
        {
            DateEdit   dateEdit   = null;
            TextEdit   textEdit   = null;
            LookUpEdit lookUpEdit = null;
            MemoEdit   memoEdit   = null;

            try
            {
                if (control.ToString().Equals("DevExpress.XtraEditors.DateEdit"))
                {
                    dateEdit = control as DateEdit;
                    if (dateEdit.Tag == null)
                    {
                        return;
                    }
                    if (dateEdit.Tag.Equals(0) && !ckIsReturn.Checked)
                    {
                        return;
                    }
                    if (dateEdit.EditValue != null)
                    {
                        return;
                    }

                    dateEdit.ErrorText = "Огноо оруулна уу.";
                    if (isActionProgress)
                    {
                        return;
                    }
                    dateEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
                else if (control.ToString().Equals("DevExpress.XtraEditors.TextEdit"))
                {
                    textEdit = control as TextEdit;
                    if (!string.IsNullOrEmpty(textEdit.Text))
                    {
                        return;
                    }

                    textEdit.ErrorText = textEdit.Tag.ToString();
                    if (isActionProgress)
                    {
                        return;
                    }
                    textEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
                else if (control.ToString().Equals("DevExpress.XtraEditors.LookUpEdit"))
                {
                    lookUpEdit = control as LookUpEdit;
                    if (lookUpEdit.Tag == null)
                    {
                        return;
                    }
                    if (lookUpEdit.EditValue != null)
                    {
                        return;
                    }

                    if (lookUpEdit.Tag.Equals(0))
                    {
                        lookUpEdit.ErrorText = "Алба/газар оруулна уу.";
                    }
                    else if (lookUpEdit.Tag.Equals(1))
                    {
                        lookUpEdit.ErrorText = "Байршил тодорхойлно уу.";
                    }
                    else
                    {
                        lookUpEdit.ErrorText = lookUpEdit.Tag.ToString();
                    }

                    if (isActionProgress)
                    {
                        return;
                    }
                    lookUpEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
                else if (control.ToString().Equals("DevExpress.XtraEditors.MemoEdit"))
                {
                    memoEdit = control as MemoEdit;
                    if (!string.IsNullOrEmpty(memoEdit.Text))
                    {
                        return;
                    }

                    memoEdit.ErrorText = memoEdit.Tag.ToString();
                    if (isActionProgress)
                    {
                        return;
                    }
                    memoEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
            }
            catch (MofException ex)
            {
                System.Diagnostics.Debug.WriteLine("Контрол шалгахад алдаа гарлаа: " + ex.InnerException.Message);
                throw new MofException("Контрол шалгахад алдаа гарлаа!", ex);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Контрол шалгахад алдаа гарлаа: " + ex.Message);
                throw new MofException("Контрол шалгахад алдаа гарлаа!", ex);
            }
            finally { dateEdit = null; textEdit = null; lookUpEdit = null; memoEdit = null; }
        }
Ejemplo n.º 4
0
        /// <summary>回车跳转到当前控件所做的处理
        ///
        /// </summary>
        /// <param name="StringArrary"></param>
        /// <param name="ctl"></param>
        public void GetPreCtl(List <string> StringArrary, string[] Ctrl, Control ctl)
        {
            switch (Ctrl[2])
            {
            case "System.Windows.Forms.TextBox":
                TextBox wintxt = new TextBox();
                wintxt = (TextBox)ctl.Controls.Find(Ctrl[1], true)[0];
                wintxt.Focus();
                wintxt.Select();
                break;

            case "DevExpress.XtraEditors.TextEdit":
                TextEdit txt = new TextEdit();
                txt = (TextEdit)ctl.Controls.Find(Ctrl[1], true)[0];
                txt.Focus();
                txt.Select();
                break;

            case "DevExpress.XtraEditors.CheckEdit":
                CheckEdit ce = new CheckEdit();
                ce = (CheckEdit)ctl.Controls.Find(Ctrl[1], true)[0];
                ce.Focus();
                ce.Checked = true;
                break;

            case "DevExpress.XtraEditors.MemoEdit":
                MemoEdit mTxt = new MemoEdit();
                mTxt = (MemoEdit)ctl.Controls.Find(Ctrl[1], false)[0];
                mTxt.Focus();
                mTxt.Select();
                break;

            case "DevExpress.XtraEditors.SimpleButton":
                SimpleButton btn = new SimpleButton();
                btn = (SimpleButton)ctl.Controls.Find(Ctrl[1], false)[0];
                btn.Focus();
                btn.Select();
                break;

            case "DevExpress.XtraEditors.LookUpEdit":
                LookUpEdit dpl = new LookUpEdit();
                dpl = (LookUpEdit)ctl.Controls.Find(Ctrl[1], false)[0];
                dpl.Focus();
                dpl.ShowPopup();
                break;

            case "DevExpress.XtraEditors.CheckedComboBoxEdit":
                CheckedComboBoxEdit ckcob = new CheckedComboBoxEdit();
                ckcob = (CheckedComboBoxEdit)ctl.Controls.Find(Ctrl[1], false)[0];
                ckcob.Focus();
                ckcob.Select();
                ckcob.ShowPopup();
                break;

            case "DevExpress.XtraEditors.DateEdit":
                DateEdit dt = new DateEdit();
                dt = (DateEdit)ctl.Controls.Find(Ctrl[1], false)[0];
                dt.Focus();
                dt.ShowPopup();
                break;

            case "DevExpress.XtraEditors.ComboBoxEdit":
                ComboBoxEdit Comb = new ComboBoxEdit();
                Comb = (ComboBoxEdit)ctl.Controls.Find(Ctrl[1], false)[0];
                Comb.Focus();
                Comb.ShowPopup();
                break;

            case "DevExpress.XtraEditors.ImageComboBoxEdit":
                ImageComboBoxEdit imgcom = new ImageComboBoxEdit();
                imgcom = (ImageComboBoxEdit)ctl.Controls.Find(Ctrl[1], false)[0];
                imgcom.Focus();
                imgcom.Select();
                imgcom.ShowPopup();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 5
0
        /// <summary>判断编辑区是否有必填项未填写
        ///
        /// </summary>
        /// <param name="CheckSaveStringArrary"></param>
        /// <param name="StrArrayList"></param>
        /// <param name="ctl"></param>
        /// <returns></returns>
        public bool GetCheckSaveCtl(List <string> CheckSaveStringArrary, List <string> StrArrayList, Control ctl)
        {
            String[] StrArray;
            String[] StrArraySave;
            for (int i = 0; i < CheckSaveStringArrary.Count; i++)
            {
                StrArraySave = CheckSaveStringArrary[i].Split(',');
                for (int j = 0; j < StrArrayList.Count; j++)
                {
                    StrArray = StrArrayList[j].Split(',');
                    switch (StrArray[2].ToString())
                    {
                    case "DevExpress.XtraEditors.TextEdit":
                        TextEdit txt = new TextEdit();
                        txt = (TextEdit)ctl.Controls.Find(StrArray[1].ToString(), true)[0];
                        if (txt.Name.Substring(3, txt.Name.Length - 3) == StrArraySave[1].ToString() && txt.Text.Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            txt.Focus();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.MemoEdit":
                        MemoEdit mTxt = new MemoEdit();
                        mTxt = (MemoEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (mTxt.Name.Substring(3, mTxt.Name.Length - 3) == StrArraySave[1].ToString() && mTxt.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            mTxt.Focus();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.LookUpEdit":
                        LookUpEdit dpl = new LookUpEdit();
                        dpl = (LookUpEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (dpl.Name.Substring(3, dpl.Name.Length - 3) == StrArraySave[1].ToString() && dpl.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            dpl.Focus();
                            dpl.ShowPopup();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.CheckedComboBoxEdit":
                        CheckedComboBoxEdit ckcob = new CheckedComboBoxEdit();
                        ckcob = (CheckedComboBoxEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (ckcob.Name.Substring(3, ckcob.Name.Length - 3) == StrArraySave[1].ToString() && ckcob.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "为必选!");
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.DateEdit":
                        DateEdit dt = new DateEdit();
                        dt = (DateEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (dt.Name.Substring(3, dt.Name.Length - 3) == StrArraySave[1].ToString() && dt.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            dt.Focus();
                            dt.ShowPopup();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.ComboBoxEdit":
                        ComboBoxEdit Comb = new ComboBoxEdit();
                        Comb = (ComboBoxEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (Comb.Name.Substring(3, Comb.Name.Length - 3) == StrArraySave[1].ToString() && Comb.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            Comb.Focus();
                            Comb.ShowPopup();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.ImageComboBoxEdit":
                        ImageComboBoxEdit imgcom = new ImageComboBoxEdit();
                        imgcom = (ImageComboBoxEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (imgcom.Name.Substring(3, imgcom.Name.Length - 3) == StrArraySave[1].ToString() && imgcom.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            imgcom.Focus();
                            imgcom.ShowPopup();
                            return(false);
                        }
                        break;

                    //case "DevExpress.XtraEditors.CheckEdit":
                    //    DevExpress.XtraEditors.CheckEdit chk = new DevExpress.XtraEditors.CheckEdit();
                    //    chk = (DevExpress.XtraEditors.CheckEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                    //    if (chk.Name.Substring(3, chk.Name.Length - 3) == StrArraySave[1].ToString() && chk.EditValue.ToString().Trim().Length == 0)
                    //    {
                    //        MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                    //        chk.Focus();
                    //        return false;
                    //    }
                    //    break;
                    default:
                        break;
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 6
0
        private void wizardControl_NextClick(object sender, DevExpress.XtraWizard.WizardCommandButtonClickEventArgs e)
        {
            if (e.Page.Tag == null)
            {
                return;
            }
            LayoutControl     currentlc   = null;
            LayoutControlItem currentItem = null;
            TextEdit          txtCtrl     = null;
            LookUpEdit        lkUpCtrl    = null;
            MemoEdit          memoCtrl    = null;
            DateEdit          dateCtrl    = null;
            bool isActionProgress         = false;
            int  number = 0;

            try
            {
                if (e.Page.Tag.Equals(1))
                {
                    if (!ckIsMovement.Checked)
                    {
                        return;
                    }

                    if (lkUpMoveBranch.EditValue == null)
                    {
                        lkUpMoveBranch.ErrorText = "Газар, албыг тодорхойлно уу.";
                        if (!isActionProgress)
                        {
                            lkUpMoveBranch.Focus();
                            isActionProgress = !isActionProgress;
                        }
                    }
                    if (lkUpMoveStaff.EditValue == null)
                    {
                        lkUpMoveStaff.ErrorText = lkUpMoveStaff.Tag.ToString();
                        if (!isActionProgress)
                        {
                            lkUpMoveStaff.Focus();
                            isActionProgress = !isActionProgress;
                        }
                    }
                    if (dateMovement.EditValue == null)
                    {
                        dateMovement.ErrorText = dateMovement.Tag.ToString();
                        if (!isActionProgress)
                        {
                            dateMovement.Focus();
                            isActionProgress = !isActionProgress;
                        }
                    }
                    if (isActionProgress)
                    {
                        e.Handled = true;
                    }
                }
                else
                {
                    if (e.Page.Controls.Count.Equals(0))
                    {
                        return;
                    }
                    if (!(e.Page.Controls[0] is LayoutControl))
                    {
                        return;
                    }
                    currentlc = e.Page.Controls[0] as LayoutControl;
                    foreach (var entry in ((System.Collections.CollectionBase)(currentlc.Items)))
                    {
                        if (entry is LayoutControlItem)
                        {
                            txtCtrl     = null;
                            lkUpCtrl    = null;
                            memoCtrl    = null;
                            dateCtrl    = null;
                            currentItem = entry as LayoutControlItem;
                            if (currentItem.Control == null)
                            {
                                continue;
                            }
                            if (currentItem.Control.Tag == null)
                            {
                                continue;
                            }
                            if (int.TryParse(currentItem.Control.Tag.ToString(), out number))
                            {
                                continue;
                            }
                            if (currentItem.Control.ToString().Equals("DevExpress.XtraEditors.TextEdit"))
                            {
                                txtCtrl = currentItem.Control as TextEdit;
                            }
                            else if (currentItem.Control.ToString().Equals("DevExpress.XtraEditors.LookUpEdit"))
                            {
                                lkUpCtrl = currentItem.Control as LookUpEdit;
                            }
                            else if (currentItem.Control.ToString().Equals("DevExpress.XtraEditors.MemoEdit"))
                            {
                                memoCtrl = currentItem.Control as MemoEdit;
                            }
                            else if (currentItem.Control.ToString().Equals("DevExpress.XtraEditors.DateEdit"))
                            {
                                dateCtrl = currentItem.Control as DateEdit;
                            }
                            else
                            {
                                continue;
                            }
                            if (txtCtrl != null)
                            {
                                if (string.IsNullOrEmpty(txtCtrl.Text))
                                {
                                    if (!txtCtrl.Enabled && !isActionProgress)
                                    {
                                        lkUpLocation.Focus();
                                        isActionProgress = !isActionProgress;
                                    }

                                    if (!isActionProgress)
                                    {
                                        txtCtrl.Focus();
                                        isActionProgress = !isActionProgress;
                                    }
                                    txtCtrl.ErrorText = txtCtrl.Tag.ToString();
                                    e.Handled         = true;
                                }
                            }
                            else if (lkUpCtrl != null)
                            {
                                if (lkUpCtrl.EditValue == null)
                                {
                                    lkUpCtrl.ErrorText = lkUpCtrl.Tag.ToString();
                                    if (!isActionProgress)
                                    {
                                        lkUpCtrl.Focus();
                                        isActionProgress = !isActionProgress;
                                    }
                                    e.Handled = true;
                                }
                            }
                            else if (memoCtrl != null)
                            {
                                if (string.IsNullOrEmpty(memoCtrl.Text))
                                {
                                    memoCtrl.ErrorText = memoCtrl.Tag.ToString();
                                    if (!isActionProgress)
                                    {
                                        memoCtrl.Focus();
                                        isActionProgress = !isActionProgress;
                                    }
                                    e.Handled = true;
                                }
                            }
                            else if (dateCtrl != null)
                            {
                                if (dateCtrl.EditValue == null)
                                {
                                    dateCtrl.ErrorText = dateCtrl.Tag.ToString();
                                    if (!isActionProgress)
                                    {
                                        dateCtrl.Focus();
                                        isActionProgress = !isActionProgress;
                                    }
                                    e.Handled = true;
                                }
                            }
                        }
                    }
                }
            }
            catch (MofException ex)
            {
                System.Diagnostics.Debug.WriteLine("Товч дарахад алдаа гарлаа: " + ex.InnerException.Message);
                Tool.ShowError(ex.Message, ex.InnerException.Message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Товч дарахад алдаа гарлаа: " + ex.Message);
                Tool.ShowError("Товч дарахад алдаа гарлаа!", ex.Message);
            }
            finally { currentlc = null; currentItem = null; txtCtrl = null; lkUpCtrl = null; memoCtrl = null; }
        }
Ejemplo n.º 7
0
        private void CheckControl(object control)
        {
            DateEdit   dateEdit   = null;
            TextEdit   textEdit   = null;
            LookUpEdit lookUpEdit = null;
            MemoEdit   memoEdit   = null;

            try
            {
                if (control.ToString().Equals("DevExpress.XtraEditors.DateEdit"))
                {
                    dateEdit = control as DateEdit;
                    if (dateEdit.EditValue != null)
                    {
                        return;
                    }

                    dateEdit.ErrorText = "Бүртгэсэн огноо оруулна уу.";
                    if (isActionProgress)
                    {
                        return;
                    }
                    dateEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
                else if (control.ToString().Equals("DevExpress.XtraEditors.TextEdit"))
                {
                    textEdit = control as TextEdit;
                    if (!string.IsNullOrEmpty(textEdit.Text))
                    {
                        return;
                    }

                    textEdit.ErrorText = textEdit.Tag.ToString();
                    if (isActionProgress)
                    {
                        return;
                    }
                    textEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
                else if (control.ToString().Equals("DevExpress.XtraEditors.LookUpEdit"))
                {
                    lookUpEdit = control as LookUpEdit;
                    if (lookUpEdit.EditValue != null)
                    {
                        return;
                    }
                    lookUpEdit.ErrorText = "Дотоод бичиг илгээх газар/хэлтсээ сонгоно уу.";

                    if (isActionProgress)
                    {
                        return;
                    }
                    lookUpEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
                else if (control.ToString().Equals("DevExpress.XtraEditors.MemoEdit"))
                {
                    memoEdit = control as MemoEdit;
                    if (!string.IsNullOrEmpty(memoEdit.Text))
                    {
                        return;
                    }

                    memoEdit.ErrorText = "Дотоод бичгийн агуулгыг оруулна уу.";
                    if (isActionProgress)
                    {
                        return;
                    }
                    memoEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
            }
            catch (MofException ex)
            {
                System.Diagnostics.Debug.WriteLine("Контрол шалгахад алдаа гарлаа: " + ex.InnerException.Message);
                throw new MofException("Контрол шалгахад алдаа гарлаа!", ex);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Контрол шалгахад алдаа гарлаа: " + ex.Message);
                throw new MofException("Контрол шалгахад алдаа гарлаа!", ex);
            }
            finally { dateEdit = null; textEdit = null; lookUpEdit = null; memoEdit = null; }
        }