private void FrmSalarySlip_Load(object sender, EventArgs e)
        {
            try
            {
                rptSalarySlip rpt = new rptSalarySlip();
                //The report you created.
                SqlConnection           myConnection = default(SqlConnection);
                SqlCommand              MyCommand    = new SqlCommand();
                SqlDataAdapter          myDA         = new SqlDataAdapter();
                EmployeePayment_DataSet myDS         = new EmployeePayment_DataSet();
                //The DataSet you created.
                frmSalaryPayment frm = new frmSalaryPayment();

                myConnection          = new SqlConnection("Data Source=GHAFFARI\\ALIGHAFFARI;Initial Catalog=CMS;Integrated Security=True;");
                MyCommand.Connection  = myConnection;
                MyCommand.CommandText = "select * from EmployeePayment";

                MyCommand.CommandType = CommandType.Text;
                myDA.SelectCommand    = MyCommand;
                myDA.Fill(myDS, "EmployeePayment");
                rpt.SetDataSource(myDS);
                crystalReportViewer1.ReportSource = rpt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void salaryPaymentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmSalaryPayment frm = new frmSalaryPayment();

            frm.label6.Text = UserType.Text;
            frm.label7.Text = User.Text;
            frm.Show();
        }
Пример #3
0
        private void frmSalaryPaymentRecord_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            frmSalaryPayment frm = new frmSalaryPayment();

            frm.label6.Text = label1.Text;
            frm.label7.Text = label3.Text;

            frm.Show();
        }
Пример #4
0
        private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                DataGridViewRow dr = dataGridView1.SelectedRows[0];
                this.Hide();
                frmSalaryPayment frm = new frmSalaryPayment();
                // or simply use column name instead of index
                //dr.Cells["id"].Value.ToString();
                frm.Show();
                frm.txtPaymentID.Text          = dr.Cells[0].Value.ToString();
                frm.cmbStaffID.Text            = dr.Cells[1].Value.ToString();
                frm.txtStaffName.Text          = dr.Cells[2].Value.ToString();
                frm.txtBasicSalary.Text        = dr.Cells[3].Value.ToString();
                frm.dtpPaymentDate.Text        = dr.Cells[4].Value.ToString();
                frm.cmbModeOfPayment.Text      = dr.Cells[5].Value.ToString();
                frm.txtPaymentModeDetails.Text = dr.Cells[6].Value.ToString();
                frm.txtDeduction.Text          = dr.Cells[7].Value.ToString();
                frm.txtTotalPaid.Text          = dr.Cells[8].Value.ToString();

                if (label1.Text == "Admin")
                {
                    frm.btnDelete.Enabled        = true;
                    frm.btnUpdate_record.Enabled = true;
                    frm.label6.Text      = label1.Text;
                    frm.label7.Text      = label3.Text;
                    frm.btnPrint.Enabled = true;
                    frm.btnSave.Enabled  = false;
                }
                else
                {
                    frm.btnDelete.Enabled        = false;
                    frm.btnUpdate_record.Enabled = false;
                    frm.label6.Text      = label1.Text;
                    frm.label7.Text      = label3.Text;
                    frm.btnPrint.Enabled = true;
                    frm.btnSave.Enabled  = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }