コード例 #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (btnAdd.Enabled)
     {
         using (var FMRA = new frm_EmpSalAddUpdate()
         {
             IsUpdate = false
         })
         {
             var P = ProjectFunctions.GetPositionInForm(this);
             FMRA.Location = new Point(P.X + (ClientSize.Width / 2 - FMRA.Size.Width / 2), P.Y + (ClientSize.Height / 2 - FMRA.Size.Height / 2));
             FMRA.ShowDialog();
         }
     }
     else
     {
         XtraMessageBox.Show("You have No permission .", "!Error");
     }
     fillGrid();
 }
コード例 #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var Dr = DocMGRGrid.GetFocusedDataRow();

            EmpCode  = Dr["EmpCode"].ToString();
            EmpMonth = Dr["MonthYear"].ToString();
            if (btnEdit.Enabled)
            {
                if (DocMGRGrid.DataSource != null)
                {
                    if (DocMGRGrid.RowCount > 0)
                    {
                        DataSet ds = ProjectFunctions.GetDataSet("Select * from PayFinal Where MonthYear='" + EmpMonth + "' And EmpCode='" + EmpCode + "'");
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            if (ds.Tables[0].Rows[0]["EmpSalLocTag"].ToString().Trim() == "Y")
                            {
                                XtraMessageBox.Show("Salary Has Been Locked");
                            }
                            else
                            {
                                using (var FMRU = new frm_EmpSalAddUpdate()
                                {
                                    IsUpdate = true, MMDocNo = EmpCode, MMDocNo1 = EmpMonth
                                })
                                {
                                    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.ShowDialog();
                                }
                            }
                        }
                        else
                        {
                            using (var FMRU = new frm_EmpSalAddUpdate()
                            {
                                IsUpdate = true, MMDocNo = EmpCode, MMDocNo1 = EmpMonth
                            })
                            {
                                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.ShowDialog();
                            }
                        }
                    }
                    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");
            }
            fillGrid();
        }