Ejemplo n.º 1
0
 private void BtnLast_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (FGridStatu == GridStatu.gsBrowse)
     {
         GV_Main.MoveLast();
     }
 }
Ejemplo n.º 2
0
        public virtual void BtnNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (FGridStatu == GridStatu.gsBrowse)
            {
                TabControlMain.SelectedTabPageIndex = 0;
                BtnNew.Enabled       = false;
                BtnQuery.Enabled     = false;
                BtnEdit.Enabled      = false;
                BtnDel.Enabled       = false;
                BtnFirst.Enabled     = false;
                BtnPrior.Enabled     = false;
                BtnNext.Enabled      = false;
                BtnLast.Enabled      = false;
                BtnSave.Enabled      = true;
                BtnCancel.Enabled    = true;
                btnAutoWidth.Enabled = false;
                FGridStatu           = GridStatu.gsAdd;

                for (int i = 0; i < MainControls.Count; i++)
                {
                    MainControls[i].Properties.ReadOnly = false;
                }

                DBFillBy(GCNum.GCN_Main, " WHERE 1=2");
                GV_Main.AddNewRow();
            }
        }
Ejemplo n.º 3
0
        public virtual void BtnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (FGridStatu == GridStatu.gsBrowse)
            {
                if (GV_Main.RowCount > 0)
                {
                    if (MessageBox.Show("確定要刪除此筆資料?", "詢問", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        GV_Main.DeleteSelectedRows();
                        GV_Main.RefreshData();
                        DBUpdate(GCNum.GCN_Main);

                        GC_Main.Refresh();
                        FGridStatu = GridStatu.gsBrowse;

                        BtnNew.Enabled       = true;
                        BtnQuery.Enabled     = true;
                        BtnEdit.Enabled      = true;
                        BtnDel.Enabled       = true;
                        BtnFirst.Enabled     = true;
                        BtnPrior.Enabled     = true;
                        BtnNext.Enabled      = true;
                        BtnLast.Enabled      = true;
                        BtnSave.Enabled      = false;
                        BtnCancel.Enabled    = false;
                        btnAutoWidth.Enabled = true;
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private void GetResult()
 {
     DicMuity.Clear();
     if (GV_Main.RowCount > 0)
     {
         if (!IsMuity)
         {
             for (int i = 0; i < F2.RETURN.Count(); i++)
             {
                 ResutnValus[i] = GV_Main.GetRowCellValue(FocusRowIndex, F2.RETURN[i]).ToString();
             }
         }
         else
         {
             for (int i = 0; i < GV_Main.RowCount; i++)
             {
                 if (GV_Main.GetRowCellValue(i, "Select").ToString() == "Y")
                 {
                     List <string> ls = new List <string>();
                     for (int j = 0; j < F2.RETURN.Length; j++)
                     {
                         ls.Add(GV_Main.GetRowCellValue(i, F2.RETURN[j]).ToString());
                     }
                     DicMuity.Add(i, ls);
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
 private void SetUnAll()
 {
     for (int i = 0; i < GV_Main.RowCount; i++)
     {
         GV_Main.SetRowCellValue(i, "Select", "N");
     }
 }
Ejemplo n.º 6
0
        private void btnDelAll_Click(object sender, EventArgs e)
        {
            int i = 0;

            while (i < GV_Main.RowCount)
            {
                GV_Main.DeleteRow(i);
            }
        }
Ejemplo n.º 7
0
        private void btnAll_Click(object sender, EventArgs e)
        {
            bool     IsExist = false;
            F2Window f2      = new F2Window(this);

            f2.SetMI         = new string[] { "POSXM", "001" };
            f2.SetMuity      = true;
            f2.SetShowWindow = false;
            Dictionary <int, List <string> > muity = null;

            if (f2.GetMI)
            {
                muity = f2.GetMuity;
                DataTable dt = null;
                if (GC_Main.DataSource == null)
                {
                    dt = new DataTable();
                    dt.Columns.Add("Select");
                    dt.Columns.Add("XM001");
                    dt.Columns.Add("XM004");
                    dt.Columns.Add("XM002");
                    GC_Main.DataSource = dt;
                }
                else
                {
                    dt = (DataTable)GC_Main.DataSource;
                }

                foreach (KeyValuePair <int, List <string> > s in muity)
                {
                    for (int i = 0; i < GV_Main.RowCount; i++)
                    {
                        if (GV_Main.GetRowCellValue(i, "XM004").ToString() == s.Value[0])
                        {
                            IsExist = true;
                            break;
                        }
                    }
                    if (IsExist)
                    {
                        IsExist = false;
                        continue;
                    }
                    else
                    {
                        DataRow dr = dt.NewRow();
                        dr[0] = "N";
                        dr[1] = s.Value[0];
                        dr[2] = s.Value[1];
                        dr[3] = s.Value[2];
                        dt.Rows.Add(dr);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public virtual void BtnCancel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (FGridStatu != GridStatu.gsBrowse)
            {
                FGridStatu = GridStatu.gsBrowse;
                GV_Main.CancelUpdateCurrentRow();
                GV_Main.RefreshData();

                for (int i = 0; i < MainControls.Count; i++)
                {
                    if (MainControls[i].Name.EndsWith("C"))
                    {
                        MainControls[i].Text = "";
                    }
                }

                if (GV_Main.RowCount > 0)
                {
                    BtnNew.Enabled       = true;
                    BtnQuery.Enabled     = true;
                    BtnEdit.Enabled      = true;
                    BtnDel.Enabled       = true;
                    BtnFirst.Enabled     = true;
                    BtnPrior.Enabled     = true;
                    BtnNext.Enabled      = true;
                    BtnLast.Enabled      = true;
                    BtnSave.Enabled      = false;
                    BtnCancel.Enabled    = false;
                    btnAutoWidth.Enabled = true;
                }
                else
                {
                    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;
                }

                for (int i = 0; i < MainControls.Count; i++)
                {
                    MainControls[i].Enabled             = true;
                    MainControls[i].Properties.ReadOnly = true;
                }
            }
        }
Ejemplo n.º 9
0
 private void GV_Main_MouseDown(object sender, MouseEventArgs e)
 {
     if (IsMuity)
     {
         GridHitInfo hitInfo = GV_Main.CalcHitInfo(e.Location);
         if (hitInfo == null || hitInfo.Column == null)
         {
             return;
         }
         if (hitInfo.InRowCell)
         {
             if (hitInfo.Column.RealColumnEdit is RepositoryItemCheckEdit)
             {
                 GV_Main.FocusedColumn    = hitInfo.Column;
                 GV_Main.FocusedRowHandle = hitInfo.RowHandle;
                 GV_Main.ShowEditor();
                 CheckEdit edit = GV_Main.ActiveEditor as CheckEdit;
                 if (edit == null)
                 {
                     return;
                 }
                 edit.Toggle();
                 DXMouseEventArgs.GetMouseArgs(e).Handled = true;
                 GV_Main.CloseEditor();
             }
         }
     }
     else
     {
         if (e.Button == System.Windows.Forms.MouseButtons.Left)
         {
             GridHitInfo hi = GV_Main.CalcHitInfo(e.Location);
             if (hi == null || hi.Column == null)
             {
                 return;
             }
             if (hi.InRowCell)
             {
                 if (hi.RowHandle == mouseDownCell.RowHandle && hi.Column == mouseDownCell.Column && mouseDownTime - DateTime.Now < DoubleClickInterval)
                 {
                     DoRowDoubleClick(sender as GridView, e.Location);
                 }
             }
             mouseDownCell = new GridCell(hi.RowHandle, hi.Column);
             mouseDownTime = DateTime.Now;
         }
     }
 }
Ejemplo n.º 10
0
        private void btnDelOne_Click(object sender, EventArgs e)
        {
            int i = 0;

            while (i < GV_Main.RowCount)
            {
                if (GV_Main.GetRowCellValue(i, "Select").ToString() == "Y")
                {
                    GV_Main.DeleteRow(i);
                }
                else
                {
                    i++;
                }
            }
        }
Ejemplo n.º 11
0
        public virtual void BtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (FGridStatu == GridStatu.gsEdit || FGridStatu == GridStatu.gsAdd)
            {
                //CheckMainField();
                if (!CheckRequiredField())
                {
                    return;
                }
                DateTimeToStr();
                GV_Main.PostEditor();
                if (DBUpdate(GCNum.GCN_Main))
                {
                    if (FGridStatu == GridStatu.gsAdd)
                    {
                        GV_Main.FocusedRowHandle = GV_Main.RowCount - 1;
                    }

                    FGridStatu = GridStatu.gsBrowse;

                    for (int i = 0; i < MainControls.Count; i++)
                    {
                        MainControls[i].Enabled             = true;
                        MainControls[i].Properties.ReadOnly = true;
                    }

                    BtnNew.Enabled       = true;
                    BtnQuery.Enabled     = true;
                    BtnEdit.Enabled      = true;
                    BtnDel.Enabled       = true;
                    BtnFirst.Enabled     = true;
                    BtnPrior.Enabled     = true;
                    BtnNext.Enabled      = true;
                    BtnLast.Enabled      = true;
                    BtnSave.Enabled      = false;
                    BtnCancel.Enabled    = false;
                    btnAutoWidth.Enabled = true;
                    IsCheckRequired      = true;
                    TabControlMain.Focus();
                }
            }
        }
Ejemplo n.º 12
0
        private void GV_Main_MouseDown(object sender, MouseEventArgs e)
        {
            GridHitInfo hitInfo = GV_Main.CalcHitInfo(e.Location);

            if (hitInfo == null || hitInfo.Column == null)
            {
                return;
            }
            if (hitInfo.Column.FieldName == "XR006")
            {
                GV_Main.FocusedColumn    = hitInfo.Column;
                GV_Main.FocusedRowHandle = hitInfo.RowHandle;
                //GV_Main.ShowEditor();
                ShowBosxMemo sbm = new ShowBosxMemo();
                sbm.SetMemo = GV_Main.GetRowCellValue(hitInfo.RowHandle, "XR006").ToString();
                sbm.ShowDialog();
                DXMouseEventArgs.GetMouseArgs(e).Handled = true;
                //GV_Main.CloseEditor();
            }
        }