コード例 #1
0
        private void btnAddRecoveryDetl_Click(object sender, EventArgs e)
        {
            AddAuditDRPlanningDetl AuditDRPlan = new AddAuditDRPlanningDetl();

            AuditDRPlan.objAuditDRPlanning = this;
            AuditDRPlan.ShowDialog();
        }
コード例 #2
0
        private void gvAuditEmpPlanningDetl_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            objSQLdb = new SQLDB();
            string          strCmd        = "";
            string          strComp       = "";
            string          strBranchCode = "";
            string          strBranType   = "";
            string          strBranName   = "";
            string          strRmarks     = "";
            DateTime        dtpPlanDate;
            DataGridViewRow rowIndex;

            if (e.RowIndex >= 0)
            {
                if (e.ColumnIndex == gvAuditEmpPlanningDetl.Columns["Edit"].Index)
                {
                    if (Convert.ToBoolean(gvAuditEmpPlanningDetl.Rows[e.RowIndex].Cells["Edit"].Selected) == true)
                    {
                        rowIndex = gvAuditEmpPlanningDetl.Rows[e.RowIndex];

                        strComp       = gvAuditEmpPlanningDetl.Rows[e.RowIndex].Cells["CompCode"].Value.ToString();
                        strBranchCode = gvAuditEmpPlanningDetl.Rows[e.RowIndex].Cells["LocationCode"].Value.ToString();
                        strBranType   = gvAuditEmpPlanningDetl.Rows[e.RowIndex].Cells["BranchType"].Value.ToString();
                        dtpPlanDate   = Convert.ToDateTime(gvAuditEmpPlanningDetl.Rows[e.RowIndex].Cells["Date"].Value.ToString());
                        strRmarks     = gvAuditEmpPlanningDetl.Rows[e.RowIndex].Cells["Remarks"].Value.ToString();

                        AddAuditDRPlanningDetl AuditDRPlan = new AddAuditDRPlanningDetl(dtpPlanDate, strComp, strBranchCode, strBranType, strRmarks, rowIndex);
                        AuditDRPlan.objAuditDRPlanning = this;
                        AuditDRPlan.ShowDialog();

                        OrderSlNo();
                    }
                }

                if (e.ColumnIndex == gvAuditEmpPlanningDetl.Columns["Del"].Index)
                {
                    DialogResult dlgResult = MessageBox.Show("Do you want delete this record?", "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dlgResult == DialogResult.Yes)
                    {
                        strCmd = "DELETE FROM AUDIT_DR_PLANNING WHERE ADRP_EORA_CODE=" + Convert.ToInt32(cbAuditEmployees.Text.ToString().Split('-')[0]) +
                                 " AND ADRP_DATE='" + Convert.ToDateTime(gvAuditEmpPlanningDetl.Rows[e.RowIndex].Cells["Date"].Value).ToString("dd/MMM/yyyy") +
                                 "'AND ADRP_TRN_TYPE='" + gvAuditEmpPlanningDetl.Rows[e.RowIndex].Cells["BranchType"].Value.ToString() +
                                 "'AND ADRP_LOCATION='" + gvAuditEmpPlanningDetl.Rows[e.RowIndex].Cells["LocationCode"].Value.ToString() + "' ";

                        int iRes = objSQLdb.ExecuteSaveData(strCmd);

                        DataGridViewRow dgvr = gvAuditEmpPlanningDetl.Rows[e.RowIndex];
                        gvAuditEmpPlanningDetl.Rows.Remove(dgvr);


                        MessageBox.Show("Selected Data Deleted Sucessfully", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        OrderSlNo();
                        //FillEmpAuditPlanningDetl();
                    }
                }
            }
        }