コード例 #1
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            switch (SelectedGrid)
            {
            case enumSelectedGrid.Detail1:
                if (dataGridDetail1.SelectedCells.Count > 0)
                {
                    Persediaan.frmStokOpnameDetailUpdate ifrmChild = new Persediaan.frmStokOpnameDetailUpdate(this, 1, (Guid)dataGridDetail1.SelectedCells[0].OwningRow.Cells["RowID1"].Value, _NamaBarang);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                }
                break;

            case enumSelectedGrid.Detail2:
                if (dataGridDetail2.SelectedCells.Count > 0)
                {
                    Persediaan.frmStokOpnameDetailUpdate ifrmChild = new Persediaan.frmStokOpnameDetailUpdate(this, 2, (Guid)dataGridDetail2.SelectedCells[0].OwningRow.Cells["RowID2"].Value, _NamaBarang);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                }
                break;

            case enumSelectedGrid.Detail3:
                if (dataGridDetail3.SelectedCells.Count > 0)
                {
                    Persediaan.frmStokOpnameDetailUpdate ifrmChild = new Persediaan.frmStokOpnameDetailUpdate(this, 3, (Guid)dataGridDetail3.SelectedCells[0].OwningRow.Cells["RowID3"].Value, _NamaBarang);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                }
                break;
            }
        }
コード例 #2
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            switch (this.ActiveControl.Name)
            {
            case "dataGridDetail1": SelectedGrid = enumSelectedGrid.Detail1; break;

            case "dataGridDetail2": SelectedGrid = enumSelectedGrid.Detail2; break;

            case "dataGridDetail3": SelectedGrid = enumSelectedGrid.Detail3; break;
            }

            switch (SelectedGrid)
            {
            case enumSelectedGrid.Header:

                break;

            case enumSelectedGrid.Detail1:
                if (dataGridHeader.SelectedCells.Count > 0)
                {
                    Persediaan.frmStokOpnameDetailUpdate ifrmChild = new Persediaan.frmStokOpnameDetailUpdate(this, 1, _RowID, _RecordID, _NamaBarang);
                    //ifrmChild.MdiParent = Program.MainForm;
                    //Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.ShowDialog();
                }
                break;

            case enumSelectedGrid.Detail2:
                if (dataGridDetail1.SelectedCells.Count > 0)
                {
                    Persediaan.frmStokOpnameDetailUpdate ifrmChild = new Persediaan.frmStokOpnameDetailUpdate(this, 2, _RowID, _RecordID, _NamaBarang);
                    //ifrmChild.MdiParent = Program.MainForm;
                    //Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.ShowDialog();
                }
                break;

            case enumSelectedGrid.Detail3:
                if (dataGridDetail2.SelectedCells.Count > 0)
                {
                    Persediaan.frmStokOpnameDetailUpdate ifrmChild = new Persediaan.frmStokOpnameDetailUpdate(this, 3, _RowID, _RecordID, _NamaBarang);
                    //ifrmChild.MdiParent = Program.MainForm;
                    //Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.ShowDialog();
                }
                break;
            }
            return;
        }
コード例 #3
0
        private void txtBarcode_Leave(object sender, EventArgs e)
        {
            string cFound = "";
            string cCari  = Tools.isNull(txtBarcode.Text.Trim(), "").ToString();

            if (cCari.Length > 0)
            {
                RefreshHeader();
                //string search = txtBarcode.Text.Trim();
                for (int i = 0; i < (dataGridHeader.Rows.Count); i++)
                {
                    string col      = "Barcode";
                    string colgroup = "GroupBC";
                    if (dataGridHeader.Rows[i].Cells[col].Value.ToString().Trim() == cCari)
                    {
                        dataGridHeader.Rows[i].Cells[col].Selected = true;
                        cFound = "1";
                        break;
                    }
                    else if (dataGridHeader.Rows[i].Cells[colgroup].Value.ToString().Trim() == cCari)
                    {
                        dataGridHeader.Rows[i].Cells[col].Selected = true;
                        cFound = "1";
                        break;
                    }
                    //if (dataGridHeader.Rows[i].Cells[col].Value.ToString().StartsWith(cCari))
                    //{
                    //    dataGridHeader.Rows[i].Cells[col].Selected = true;
                    //    cFound = "1";
                    //    break;
                    //}
                }
                if (cFound != "1")
                {
                    MessageBox.Show("Barcode tidak ada.");
                    txtBarcode.Text = "";
                    txtBarcode.Focus();
                    return;
                }

                DataTable dtr = new DataTable();
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database())
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_GetLastRowNumber"));
                        dtr = db.Commands[0].ExecuteDataTable();
                    }
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }

                string _cRowNumber = "";
                int    _NoRecord   = 0;
                if (dtr.Rows.Count > 0)
                {
                    _NoRecord   = Convert.ToInt32(Tools.isNull(dtr.Rows[0]["NoRecord"], "0").ToString()) + 1;
                    _cRowNumber = _NoRecord.ToString().Trim().PadLeft(7, '0');
                }

                Persediaan.frmStokOpnameDetailUpdate ifrmChild = new Persediaan.frmStokOpnameDetailUpdate(this, 1, _RowID, _RecordID, _NamaBarang, _cRowNumber);
                ifrmChild.ShowDialog();
                txtBarcode.Text = "";
                txtBarcode.Focus();
            }
        }