Beispiel #1
0
        public virtual bool CheckRequiredField()
        {
            if (IsNowDeleteRow)
            {
                IsNowDeleteRow = false;
                return(true);
            }

            if (RequiredFieldMain != "")
            {
                string[] mTemp = RequiredFieldMain.Split(',');
                if (GV_Main != null)
                {
                    for (int i = 0; i < mTemp.Length; i++)
                    {
                        if (GV_Main.GetFocusedRowCellValue(mTemp[i]) != null)
                        {
                            if (GV_Main.GetFocusedRowCellValue(mTemp[i]).ToString() == "")
                            {
                                IsCheckRequired = false;
                                MessageBox.Show(GV_Main.Columns[mTemp[i]].GetTextCaption() + " 不可空白!", "錯誤");
                                return(false);
                            }
                        }
                    }
                }
            }
            return(true);
        }
Beispiel #2
0
        public virtual void InitUIVar()
        {
            SetDateTimeField();
            SetCheckEditField();
            SetNumberField();
            SetButtonEditField();
            SetPassWordEditField();
            BtnNew.Enabled       = true;
            BtnQuery.Enabled     = true;
            BtnEdit.Enabled      = false;
            BtnDel.Enabled       = false;
            BtnFirst.Enabled     = false;
            BtnPrior.Enabled     = false;
            BtnNext.Enabled      = false;
            BtnLast.Enabled      = false;
            BtnSave.Enabled      = false;
            BtnCancel.Enabled    = false;
            btnAutoWidth.Enabled = true;
            KeyListMain          = new List <string>(KeyFieldMain.Split(','));
            RequiredListMain     = new List <string>(RequiredFieldMain.Split(','));
            string[] Manage = new string[] { "COMPANY", "CREATOR", "USR_GROUP", "CREATE_DATE", "MODIFIER", "MODI_DATE", "FLAG", "CREATE_TIME", "MODI_TIME", "TRANS_TYPE", "TRANS_NAME" };

            for (int i = 0; i < Manage.Count(); i++)
            {
                if (GV_Main.Columns.Count < i)
                {
                    break;
                }

                if (GV_Main.Columns[Manage[i]] != null)
                {
                    GV_Main.Columns[Manage[i]].Visible = false;
                }
            }

            if (VisibleFieldMain.Trim() != "")
            {
                string[] mTemp = VisibleFieldMain.Split(',');
                for (int i = 0; i < mTemp.Count(); i++)
                {
                    GV_Main.Columns[mTemp[i]].Visible = false;
                }
            }

            for (int i = 0; i < GV_Main.Columns.Count; i++)
            {
                GV_Main.Columns[i].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            }

            for (int i = 0; i < MainControls.Count; i++)
            {
                MainControls[i].Properties.ReadOnly = true;
                if (KeyListMain.Contains(MainControls[i].Name))
                {
                    MainControls[i].ForeColor = Color.White;
                    MainControls[i].BackColor = Color.FromArgb(88, 88, 88);
                }
                if (RequiredListMain.Contains(MainControls[i].Name))
                {
                    MainControls[i].BackColor = Color.FromArgb(255, 255, 192);
                }
            }

            for (int i = 0; i < KeyListMain.Count; i++)
            {
                GV_Main.Columns[KeyListMain[i]].AppearanceHeader.BackColor    = Color.FromArgb(88, 88, 88);
                GV_Main.Columns[KeyListMain[i]].AppearanceHeader.BackColor2   = Color.Gray;
                GV_Main.Columns[KeyListMain[i]].AppearanceHeader.ForeColor    = Color.White;
                GV_Main.Columns[KeyListMain[i]].AppearanceHeader.BorderColor  = Color.Black;
                GV_Main.Columns[KeyListMain[i]].AppearanceHeader.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
            }

            WidthColumns(GCNum.GCN_Main, FieldWidthMain);
            SortColumns(GCNum.GCN_Main, VisibleListMain);
        }