Ejemplo n.º 1
0
        private void btnSanction_Click(object sender, EventArgs e)
        {
            string err = DataValidate();

            if (!string.IsNullOrEmpty(err))
            {
                MessageBox.Show(err, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            btnSelectAll.Enabled  = false;
            btnClearAll.Enabled   = false;
            txtWrkGrpCode.Enabled = false;
            txtUnitCode.Enabled   = false;
            txtDeptCode.Enabled   = false;
            txtStatCode.Enabled   = false;
            txtFromDt.Enabled     = false;
            txtToDt.Enabled       = false;

            string tType = cmbList.Text.Trim();


            Cursor.Current = Cursors.WaitCursor;
            foreach (DataRow dr in SelDt.Rows)
            {
                dr["Remarks"] = "Processing";
                string tEmpUnqID = dr["EmpUnqID"].ToString();
                string status    = string.Empty;

                if (GType == "WO")
                {
                    pro.WoChange(tEmpUnqID, txtFromDt.DateTime, txtToDt.DateTime, tType, out status);
                }
                else
                {
                    pro.ShiftChange(tEmpUnqID, txtFromDt.DateTime, txtToDt.DateTime, tType, out status);
                }

                if (string.IsNullOrEmpty(status))
                {
                    dr["Remarks"] = "Posted..";
                }
                else
                {
                    dr["Remarks"] = status;
                }

                dr.AcceptChanges();
            }

            gv_Sel.RefreshData();

            Cursor.Current = Cursors.Default;

            MessageBox.Show("Data Posting is compleated, please export result for check Remarks of indivisual status", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);


            btnSelectAll.Enabled  = true;
            btnClearAll.Enabled   = true;
            txtWrkGrpCode.Enabled = true;
            txtUnitCode.Enabled   = true;
            txtDeptCode.Enabled   = true;
            txtStatCode.Enabled   = true;
            txtFromDt.Enabled     = true;
            txtToDt.Enabled       = true;
        }