private void btnApprove_Click(object sender, EventArgs e) { try { removeControlsFrompnllvPanel(); WorkplaceCRDB wpdb = new WorkplaceCRDB(); DialogResult dialog = MessageBox.Show("Are you sure to Accept the document ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { prevwp.Remarks = txtRemarks.Text; if (wpdb.AcceptComplaint(prevwp)) { MessageBox.Show("Complaint Accepted"); closeAllPanels(); listOption = 1; ListFilteredWCR(listOption); setButtonVisibility("btnEditPanel"); //activites are same for cance, forward,approce and reverse btnComplaintReg.Focus(); } } } catch (Exception) { } }
private void btnReject_Click(object sender, EventArgs e) { try { removeControlsFrompnllvPanel(); WorkplaceCRDB wpdb = new WorkplaceCRDB(); DialogResult dialog = MessageBox.Show("Are you sure to Reject the Complaint ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { prevwp.Remarks = txtRemarks.Text; if (wpdb.RejectComplaintRegByMO(prevwp)) { MessageBox.Show("complaint Rejected"); clearData(); pnlInner.Visible = false; pnlOuter.Visible = false; listOption = 1; setButtonVisibility("btnEditPanel"); ListFilteredWCR(listOption); btnComplaintReg.Focus(); } } } catch (Exception) { } }
private void btnRejectCLosing_Click(object sender, EventArgs e) { try { removeControlsFrompnllvPanel(); WorkplaceCRDB wpdb = new WorkplaceCRDB(); DialogResult dialog = MessageBox.Show("Are you sure to reject the MO action?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { string remark = Login.userLoggedInName + " : " + UpdateTable.getSQLDateTime().ToString("dd-MM-yyyy HH:mm:ss") + " : " + "Work done is rejected"; prevwp.Remarks = txtRemarks.Text + Environment.NewLine + remark; prevwp.AcceptTime = DateTime.Parse("01-01-1900"); prevwp.CloseTime = DateTime.Parse("01-01-1900"); if (wpdb.RejectComplaintRegByUser(prevwp)) { MessageBox.Show("Complaint re-Opened"); clearData(); pnlInner.Visible = false; pnlOuter.Visible = false; listOption = 1; setButtonVisibility("btnEditPanel"); ListFilteredWCR(listOption); btnComplaintReg.Focus(); } } } catch (Exception) { } }
private string getEmplRoleStr() { string role = ""; WorkplaceCRDB wpdb = new WorkplaceCRDB(); role = WorkplaceCRDB.getEmployeeRoleForMOOrMM(); return(role); }
private void btnClose_Click(object sender, EventArgs e) { try { removeControlsFrompnllvPanel(); WorkplaceCRDB wpdb = new WorkplaceCRDB(); DialogResult dialog = MessageBox.Show("Are you sure to Close the Complaint ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { prevwp.Remarks = txtRemarks.Text; if (roles.Contains("MM")) { string remark = Login.userLoggedInName + " : " + UpdateTable.getSQLDateTime().ToString("dd-MM-yyyy HH:mm:ss") + " : " + "Request Closed"; prevwp.Remarks = txtRemarks.Text + Environment.NewLine + remark; if (wpdb.CloseComplaintByMM(prevwp)) { MessageBox.Show("complaint Closed"); clearData(); pnlInner.Visible = false; pnlOuter.Visible = false; listOption = 1; setButtonVisibility("btnEditPanel"); ListFilteredWCR(listOption); btnComplaintReg.Focus(); } } else { string remark = Login.userLoggedInName + " : " + UpdateTable.getSQLDateTime().ToString("dd-MM-yyyy HH:mm:ss") + " : " + "Work Completetd"; prevwp.Remarks = txtRemarks.Text + Environment.NewLine + remark; if (wpdb.CloseComplaintByMO(prevwp)) { MessageBox.Show("complaint Closed"); clearData(); pnlInner.Visible = false; pnlOuter.Visible = false; listOption = 1; setButtonVisibility("btnEditPanel"); ListFilteredWCR(listOption); } } } } catch (Exception) { } }
private void ListFilteredComplaints(int opt) { try { grdList.Rows.Clear(); WorkplaceCRDB wcdb = new WorkplaceCRDB(); string ComplaintType = ""; if (opt == 1) { ComplaintType = ((Structures.ComboBoxItem)cmbComplaintType.SelectedItem).HiddenValue; } //ComplaintType = ((Structures.ComboBoxItem)cmbComplaintType.SelectedItem).HiddenValue; List <workplacecr> CompList = wcdb.getFilteredComplaintsForReport(opt, dtFromDate.Value, dtToDate.Value, ComplaintType); foreach (workplacecr br in CompList) { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["cDate"].Value = br.CreateTime; grdList.Rows[grdList.RowCount - 1].Cells["Complainer"].Value = br.EmployeeName; grdList.Rows[grdList.RowCount - 1].Cells["ComplaintType"].Value = br.ComplaintType; grdList.Rows[grdList.RowCount - 1].Cells["ComplaintDescription"].Value = br.ComplaintDescription; grdList.Rows[grdList.RowCount - 1].Cells["Remark"].Value = br.Remarks; if (br.AcceptTime != DateTime.MinValue) { grdList.Rows[grdList.RowCount - 1].Cells["AcceptTime"].Value = br.AcceptTime; } if (br.AcceptTime != DateTime.MinValue) { grdList.Rows[grdList.RowCount - 1].Cells["ClosedTime"].Value = br.CloseTime; } grdList.Rows[grdList.RowCount - 1].Cells["Status"].Value = valuetostring(br.Status, br.DocumentStatus); //grdList.Rows[grdList.RowCount - 1].Cells["DocStatus"].Value = br.DocumentStatus; } } catch (Exception ex) { MessageBox.Show("Error in Complaint Listing"); } setButtonVisibility("init"); if (grdList.Rows.Count > 0) { btnExportExcel.Visible = true; } else { btnExportExcel.Visible = false; } pnlList.Visible = true; }
private void ListFilteredWCR(int option) { try { grdList.Rows.Clear(); WorkplaceCRDB crdb = new WorkplaceCRDB(); List <workplacecr> CRList = new List <workplacecr>(); forwarderList = demDB.getForwarders(docID, Login.empLoggedIn); approverList = demDB.getApprovers(docID, Login.empLoggedIn); if (roles.Equals("MO") || roles.Equals("MM")) { CRList = crdb.getFilteredComplaintsForMO(option); } else { CRList = crdb.getFilteredComplaintsForUser(option); } if (option == 1) { lblActionHeader.Text = "Complaints registered"; btnComplaintReg.Focus(); } if (option == 2) { lblActionHeader.Text = "Complaints accepted by the Maintenance Officer"; btnCmplntAccepted.Focus(); } else if (option == 3) { lblActionHeader.Text = "Complaint history"; btnCmplntStatus.Focus(); } foreach (workplacecr cr in CRList) { if (option == 1) { if (cr.DocumentStatus == 99) { continue; } } else { } grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["RowID"].Value = cr.rowID; grdList.Rows[grdList.RowCount - 1].Cells["EmpId"].Value = cr.EmployeeID; grdList.Rows[grdList.RowCount - 1].Cells["EmployeeName"].Value = cr.EmployeeName; grdList.Rows[grdList.RowCount - 1].Cells["ComplaintType"].Value = cr.ComplaintType; grdList.Rows[grdList.RowCount - 1].Cells["ComplaintDesc"].Value = cr.ComplaintDescription; grdList.Rows[grdList.RowCount - 1].Cells["AcceptTime"].Value = cr.AcceptTime; grdList.Rows[grdList.RowCount - 1].Cells["CloseTime"].Value = cr.CloseTime; grdList.Rows[grdList.RowCount - 1].Cells["Remarks"].Value = cr.Remarks; grdList.Rows[grdList.RowCount - 1].Cells["DocumentStatus"].Value = cr.DocumentStatus; grdList.Rows[grdList.RowCount - 1].Cells["Status"].Value = valuetostring(cr.Status, cr.DocumentStatus); grdList.Rows[grdList.RowCount - 1].Cells["CreateTime"].Value = cr.CreateTime; grdList.Rows[grdList.RowCount - 1].Cells["CreateUser"].Value = cr.CreateUser; grdList.Rows[grdList.RowCount - 1].Cells["Creator"].Value = cr.Creator; } } catch (Exception ex) { MessageBox.Show("Error in WorkPlaceCR Header listing"); } setButtonVisibility("init"); if (listOption == 2 || listOption == 3) { grdList.Columns["View"].Visible = true; grdList.Columns["Edit"].Visible = false; } else { grdList.Columns["View"].Visible = false; grdList.Columns["Edit"].Visible = true; } if (roles.Contains("MM") || roles.Contains("MO")) { if (listOption == 2) { grdList.Columns["View"].Visible = false; grdList.Columns["Edit"].Visible = true; } } if (roles.Contains("MO") && listOption == 1) { grdList.Columns["Edit"].HeaderText = "Accept"; foreach (DataGridViewRow row in grdList.Rows) { DataGridViewButtonColumn col = (DataGridViewButtonColumn)grdList.Columns["Edit"]; col.Text = "Accept"; } } else if (roles.Contains("MM") && (listOption == 1 || listOption == 2)) { grdList.Columns["Edit"].HeaderText = "Close"; foreach (DataGridViewRow row in grdList.Rows) { DataGridViewButtonColumn col = (DataGridViewButtonColumn)grdList.Columns["Edit"]; col.Text = "Close"; } } else if (roles.Contains("MO") && listOption == 2) { grdList.Columns["Edit"].HeaderText = "Close"; foreach (DataGridViewRow row in grdList.Rows) { DataGridViewButtonColumn col = (DataGridViewButtonColumn)grdList.Columns["Edit"]; col.Text = "Close"; } } else { grdList.Columns["Edit"].HeaderText = "Edit"; foreach (DataGridViewRow row in grdList.Rows) { DataGridViewButtonColumn col = (DataGridViewButtonColumn)grdList.Columns["Edit"]; col.Text = "Edit"; } } pnlList.Visible = true; }
private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } string columnName = grdList.Columns[e.ColumnIndex].Name; if (columnName.Equals("Edit") || columnName.Equals("View") || columnName.Equals("Accept")) { clearData(); setButtonVisibility(columnName); enableControlsApprove(); pnlInner.Enabled = true; prevwp = new workplacecr(); int rowID = e.RowIndex; try { prevwp.rowID = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["RowID"].Value.ToString()); prevwp.EmployeeID = grdList.Rows[e.RowIndex].Cells["EmpId"].Value.ToString(); prevwp.EmployeeName = grdList.Rows[e.RowIndex].Cells["EmployeeName"].Value.ToString(); prevwp.AcceptTime = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["AcceptTime"].Value.ToString()); prevwp.CloseTime = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["CloseTime"].Value.ToString()); prevwp.Remarks = grdList.Rows[e.RowIndex].Cells["Remarks"].Value.ToString(); prevwp.ComplaintDescription = grdList.Rows[e.RowIndex].Cells["ComplaintDesc"].Value.ToString(); prevwp.ComplaintType = grdList.Rows[e.RowIndex].Cells["ComplaintType"].Value.ToString(); //prevwp.DocumentStatus = stringtovalue(grdList.Rows[e.RowIndex].Cells["DocumentStatus"].Value.ToString()); prevwp.DocumentStatus = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["DocumentStatus"].Value.ToString()); prevwp.Status = stringtovalue(grdList.Rows[e.RowIndex].Cells["Status"].Value.ToString()); setvisiblityOfEditBtn(); if (roles.Equals("MM")) { disableControlsOfInner(); if ((prevwp.Status != 6 && prevwp.Status != 5) && listOption != 3) { btnClose.Visible = true; btnAddComment.Enabled = true; } } else if (roles.Equals("MO")) { if (listOption == 1) { disableControlsOfInner(); btnAddComment.Enabled = true; btnAccept.Visible = true; //btnReject.Visible = true; } else if (listOption == 2) { disableControlsOfInner(); btnAddComment.Enabled = true; btnClose.Visible = true; } else { disableControlsOfInner(); } } else { if (listOption == 1) { if (prevwp.DocumentStatus == 3) { disableControlsOfInner(); btnSave.Visible = true; btnAddComment.Enabled = true; } else { enableControlsApprove(); btnSave.Visible = true; btnCancelComplaint.Visible = true; } } else if (listOption == 3) { disableControlsOfInner(); if (prevwp.Status == 3 || prevwp.Status == 5) { if (WorkplaceCRDB.IsAllowToRejectClosedComplaint(prevwp)) { btnRejectCLosing.Visible = true; btnAddComment.Enabled = true; } } } else { disableControlsOfInner(); } } setvisiblityOfTime(); if (prevwp.Status == 2 || prevwp.Status == 5) { lblAcceptTime.Visible = true; dtAcceptTime.Visible = true; if (prevwp.Status == 5) { lblCloseTime.Visible = true; dtCloseTime.Visible = true; } } else if (prevwp.Status == 3) { lblCloseTime.Visible = true; dtCloseTime.Visible = true; } else if (prevwp.Status == 6) { lblCloseTime.Visible = true; dtCloseTime.Visible = true; string strr = prevwp.AcceptTime.ToString(); string strr1 = DateTime.MinValue.ToString(); if (!(prevwp.AcceptTime.ToString().Equals(DateTime.MinValue.ToString())) && prevwp.DocumentStatus != 3) { lblAcceptTime.Visible = true; dtAcceptTime.Visible = true; } } prevwp.Remarks = grdList.Rows[e.RowIndex].Cells["Remarks"].Value.ToString(); prevwp.CreateTime = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["CreateTime"].Value.ToString()); prevwp.CreateUser = grdList.Rows[e.RowIndex].Cells["CreateUser"].Value.ToString(); prevwp.AcceptTime = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["AcceptTime"].Value.ToString()); prevwp.CloseTime = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["CloseTime"].Value.ToString()); } catch (Exception ex) { } Boolean str = btnAddComment.Enabled; btnSave.Text = "Update"; pnlInner.Visible = true; pnlOuter.Visible = true; pnlList.Visible = false; txtEmpId.Text = prevwp.EmployeeID.ToString(); txtComplDesc.Text = prevwp.ComplaintDescription; ////////cmbComplaintType.SelectedIndex = cmbComplaintType.FindString(prevwp.ComplaintType); cmbComplaintType.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbComplaintType, prevwp.ComplaintType); txtRemarks.Text = prevwp.Remarks; dtAcceptTime.Value = prevwp.AcceptTime; dtCloseTime.Value = prevwp.CloseTime; } } catch (Exception ex) { } }
private void btnSave_Click_1(object sender, EventArgs e) { Boolean status = true; try { removeControlsFrompnllvPanel(); WorkplaceCRDB wpDB = new WorkplaceCRDB(); workplacecr wp = new workplacecr(); ////wp.ComplaintType = cmbComplaintType.SelectedItem.ToString().Trim().Substring(0, cmbComplaintType.SelectedItem.ToString().Trim().IndexOf('-')); wp.ComplaintType = ((Structures.ComboBoxItem)cmbComplaintType.SelectedItem).HiddenValue; wp.EmployeeID = txtEmpId.Text; wp.Remarks = txtRemarks.Text; wp.ComplaintDescription = txtComplDesc.Text; string btnText = btnSave.Text; if (btnText.Equals("Update")) { if (wpDB.validateComplaintReg(wp)) { if (wpDB.updateComplaintReg(wp, prevwp)) { MessageBox.Show("Complaint updated"); closeAllPanels(); listOption = 1; ListFilteredWCR(listOption); setButtonVisibility("btnEditPanel"); btnComplaintReg.Focus(); } else { status = false; MessageBox.Show("Failed to update Complaint"); } } else { status = false; MessageBox.Show("Validation Failed: please check data entered"); } } else if (btnText.Equals("Save")) { //if (!MovementRegisterDB.checkMovementStatus(mr)) //{ // MessageBox.Show("Not allowed. Already One movement is on process"); // return; //} wp.Status = 1;//created wp.DocumentStatus = 1; if (wpDB.validateComplaintReg(wp)) { if (wpDB.insertComplaintReg(wp)) { MessageBox.Show("Complaint Added"); closeAllPanels(); listOption = 1; ListFilteredWCR(listOption); btnComplaintReg.Focus(); } else { MessageBox.Show("Failed to Insert Complaint"); status = false; } } else { status = false; MessageBox.Show("Validation Failed: please check data entered"); } } else { status = false; MessageBox.Show("Compalint Data Operation failed"); } } catch (Exception ex) { MessageBox.Show("Failed Adding / Editing Complaint"); status = false; } if (status) { setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save } }