コード例 #1
0
        private void FillGrid()
        {
            string  sql = string.Format("SELECT        LoanMonthlyData.MonthYear, LoanMonthlyData.EmpCode, EmpMST.EmpName, EmpMST.EmpFHName, LoanMonthlyData.LoanInstlmnt, LoanMonthlyData.TransID FROM            LoanMonthlyData INNER JOIN EmpMST ON LoanMonthlyData.EmpCode = EmpMST.EmpCode where MonthYear = '{0}{1}'", DtStartDate.Text.Substring(0, 2), DtStartDate.Text.Substring(DtStartDate.Text.Length - 2, 2));
            DataSet ds  = ProjectFunctions.GetDataSet(sql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                LoanGrid.DataSource = ds.Tables[0];
                LoanGridView.BestFitColumns();
            }
            else
            {
                LoanGrid.DataSource = null;
            }
        }
コード例 #2
0
        private void Btn_Edit_Click(object sender, EventArgs e)
        {
            var Dr = LoanGridView.GetFocusedDataRow();

            if (btn_Edit.Enabled)
            {
                if (LoanGridView.DataSource != null)
                {
                    if (LoanGridView.RowCount > 0)
                    {
                        using (var FMRU = new FrmLoanMonthlyData()
                        {
                            IsUpdate = true, LoanId = Dr["TransID"].ToString()
                        })
                        {
                            var P = ProjectFunctions.GetPositionInForm(this);
                            FMRU.Location = new Point(P.X + (ClientSize.Width / 2 - FMRU.Size.Width / 2), P.Y + (ClientSize.Height / 2 - FMRU.Size.Height / 2));
                            FMRU.Text     = "Loan Monthly Editing";

                            FMRU.ShowDialog();
                            FillGrid();
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("No Records to Edit", "!Error");
                    }
                }
                else
                {
                    XtraMessageBox.Show("No Datasource, Or Unable to fetch Data.", "!Error");
                }
            }
            else
            {
                XtraMessageBox.Show("You have No permission.", "!Error");
            }
        }