Пример #1
0
        private void btnSelectEmp_Click(object sender, EventArgs e)
        {
            frmPubSelectEmp frm = new frmPubSelectEmp();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                txtEmp.Text = frm.EmpName;
                txtEmp.Tag  = frm.EmpNo;
            }
        }
Пример #2
0
        private void btnSelectEmp_Click(object sender, EventArgs e)
        {
            frmPubSelectEmp frm = new frmPubSelectEmp(false);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                txtEmpNo.Text = frm.EmpNo;
                txtEmpNo_Leave(null, null);
            }
        }
Пример #3
0
        private void btnSelectEmp_Click(object sender, EventArgs e)
        {
            frmPubSelectEmp frm;

            frm = new frmPubSelectEmp(otherCoin);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                txtFind.Text = frm.EmpNo;
                btnFindEmp.PerformClick();
            }
        }
Пример #4
0
        private void dataGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            frmPubSelectDepart frmDepart;
            frmPubSelectEmp    frmEmp;
            frmPubSelectIDName frmID;

            if ((e.RowIndex < 0) || (e.ColumnIndex != 5))
            {
                return;
            }
            string title = dataGrid[2, e.RowIndex].Value.ToString();

            switch (dataGrid[7, e.RowIndex].Value.ToString().ToLower())
            {
            case "empno":
                frmEmp = new frmPubSelectEmp();
                if (frmEmp.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmEmp.EmpNo;
                    dataGrid[8, e.RowIndex].Value = frmEmp.EmpNo;
                }
                break;

            case "empname":
                frmEmp = new frmPubSelectEmp();
                if (frmEmp.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmEmp.EmpName;
                    dataGrid[8, e.RowIndex].Value = frmEmp.EmpNo;
                }
                break;

            case "departid":
                frmDepart = new frmPubSelectDepart();
                if (frmDepart.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmDepart.DepartID;
                    dataGrid[8, e.RowIndex].Value = frmDepart.DepartID;
                }
                break;

            case "departname":
                frmDepart = new frmPubSelectDepart();
                if (frmDepart.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmDepart.DepartName;
                    dataGrid[8, e.RowIndex].Value = frmDepart.DepartID;
                }
                break;

            case "cardsectorno":
            case "cardno":
                frmEmp = new frmPubSelectEmp();
                if (frmEmp.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmEmp.CardSectorNo;
                    dataGrid[8, e.RowIndex].Value = frmEmp.CardSectorNo;
                }
                break;

            case "cardphysicsno10":
                frmEmp = new frmPubSelectEmp();
                if (frmEmp.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmEmp.CardPhysicsNo10;
                    dataGrid[8, e.RowIndex].Value = frmEmp.CardPhysicsNo10;
                }
                break;

            case "cardphysicsno8":
                frmEmp = new frmPubSelectEmp();
                if (frmEmp.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmEmp.CardPhysicsNo8;
                    dataGrid[8, e.RowIndex].Value = frmEmp.CardPhysicsNo8;
                }
                break;

            case "sftypeid":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "501" }), "SFTypeID", "SFTypeName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectID;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectID;
                }
                break;

            case "sftypename":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "501" }), "SFTypeID", "SFTypeName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectName;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectName;
                }
                break;

            case "sfmealtypeid":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "502" }), "SFMealTypeID", "SFMealTypeName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectID;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectID;
                }
                break;

            case "sfmealtypename":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "502" }), "SFMealTypeID", "SFMealTypeName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectName;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectName;
                }
                break;

            case "cardstatusid":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "503" }), "CardStatusID", "CardStatusName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectID;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectID;
                }
                break;

            case "cardstatusname":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "503" }), "CardStatusID", "CardStatusName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectName;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectName;
                }
                break;

            case "syopterid":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "504" }), "SYOpterID", "SYOpterName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectID;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectID;
                }
                break;

            case "syoptername":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "504" }), "SYOpterID", "SYOpterName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectName;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectName;
                }
                break;

            case "cardtypeid":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "203" }), "CardTypeID", "CardTypeName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectID;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectID;
                }
                break;

            case "cardtypename":
                frmID = new frmPubSelectIDName(Column13.HeaderText + "[" + dataGrid[1, e.RowIndex].Value.ToString() + "]",
                                               Pub.GetSQL(DBCode.DB_000001, new string[] { "203" }), "CardTypeID", "CardTypeName");
                if (frmID.ShowDialog() == DialogResult.OK)
                {
                    dataGrid[4, e.RowIndex].Value = frmID.SelectName;
                    dataGrid[8, e.RowIndex].Value = frmID.SelectName;
                }
                break;
            }
            string v = "";

            v = dataGrid[2, e.RowIndex].Value.ToString();
            int index = _FieldText.IndexOf(v);

            if (index < 0)
            {
                return;
            }
            DateTime d = new DateTime();

            switch (_FieldType[index])
            {
            case GRFieldType.grftDateTime:
                DateTime.TryParse(dataGrid[3, e.RowIndex].Value.ToString(), out d);
                if (Pub.GetSelectDate(_ShowTime, ref d))
                {
                    if (_ShowTime)
                    {
                        dataGrid[4, e.RowIndex].Value = d.ToString(SystemInfo.SQLDateTimeFMT);
                    }
                    else
                    {
                        dataGrid[4, e.RowIndex].Value = d.ToString(SystemInfo.SQLDateFMT);
                    }
                    dataGrid[8, e.RowIndex].Value = dataGrid[4, e.RowIndex].Value;
                }
                break;
            }
        }