private void ddlArea_SelectedIndexChanged(object sender, EventArgs e) { ddlType.Enabled = true; DocumentsStoredTypeBindingSource.DataSource = DocumentsStoredTypeService.GetByDeparmentIdForDropBox(Conversions.ToInteger(ddlArea.SelectedValue), false); ddlType.Refresh(); SearchDocs(); }
public void LoadForm() { EmployeeNameBindingSource.DataSource = EmployeeService.GetFirstNameLastNameForDropBox(); DocumentsStoredDepartmentBindingSource.DataSource = DocumentsStoredDepartmentService.GetAll(); DocumentsStoredTypeBindingSource.DataSource = DocumentsStoredTypeService.GetByDeparmentId(Conversions.ToInteger(ddlArea.SelectedValue)); txtExpireDate.CustomFormat = " "; txtIssueDate.CustomFormat = " "; ConfigLayoutForUserPerfil(); }
public void ConfigLayoutForUserPerfil() { int IdUser = My.MyProject.Forms.FrmLoginWindow._userID; switch (IdUser) { // 54 - JORDAN // 63 - LYNDON // 70 - MAY // 124 - Vania // 135 - Roger // 163 - Emilio case 135: { btnAddDepartment.Visible = false; ddlArea.SelectedValue = 18; DocumentsStoredTypeBindingSource.DataSource = DocumentsStoredTypeService.GetByDeparmentIdForDropBox(Conversions.ToInteger(ddlArea.SelectedValue), true); ddlArea.Enabled = false; break; } case 70: { btnAddDepartment.Visible = false; ddlArea.SelectedValue = 17; DocumentsStoredTypeBindingSource.DataSource = DocumentsStoredTypeService.GetByDeparmentIdForDropBox(Conversions.ToInteger(ddlArea.SelectedValue), true); ddlArea.Enabled = false; break; } case 54: { btnAddDepartment.Visible = true; break; } case 63: { btnAddDepartment.Visible = true; break; } case 124: { btnAddDepartment.Visible = true; break; } case 163: { btnAddDepartment.Visible = true; break; } } }
/* TODO ERROR: Skipped EndRegionDirectiveTrivia */ /* TODO ERROR: Skipped RegionDirectiveTrivia */ public void LoadForm() { EmployeeNameBindingSource.DataSource = EmployeeService.GetFirstNameLastNameForDropBox(); ddlEmployee.SelectedValue = 0; DocumentsStoredDepartmentBindingSource.DataSource = DocumentsStoredDepartmentService.GetAllForDropBox(); ddlArea.SelectedValue = 0; DocumentsStoredTypeBindingSource.DataSource = DocumentsStoredTypeService.GetByDeparmentIdForDropBox(Conversions.ToInteger(ddlArea.SelectedValue), false); DocumentsStoredBindingSource.DataSource = DocumentsStoredService.GetByFilters(txtFileType.Text, txtDecription.Text, "", "", 0, "", "", true); txtStartDate.CustomFormat = " "; txtEndDate.CustomFormat = " "; ConfigLayoutForUserPerfil(); }
private void CreateSubFolderInFTPServer(int DepartmentId, string Department, string TypeDoc) { // 1 - Handles blank field errors if (string.IsNullOrEmpty(Department) | string.IsNullOrEmpty(TypeDoc) | string.IsNullOrWhiteSpace(TypeDoc)) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("The Department and/or Document Type field must not be empty!", "Attention!", this); return; } // 2 - Checks whether the Department folder already exists if (DocumentsStoredTypeService.VerifyDocumentsStoredTypeEquals(DepartmentId, TypeDoc)) { MessageBox.Show("This type of document already exists for the Department!", "Atention!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // 3 - creates the folder on the FTP Server if (ftpser.CreateSubFolder(ddlDepartment.Text, txtDocumentType.Text.Replace(" ", "_").Replace(",", "_"))) { // 4 - After creating the folder in the server, insert the information in the database if (DocumentsStoredTypeService.Insert(txtDocumentType.Text.Replace(" ", "_").Replace(",", "_"), Conversions.ToInteger(ddlDepartment.SelectedValue))) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Document type successfully inserted!", "Success!", this); My.MyProject.Forms.frmAddEditStoreFiles.LoadDocType(); Close(); } else { // 5 - Deleta pasta criada no Server FTP e dispara mensagem My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("It was not possible to create this Department! Contact IT Department.", "Error!", this); ftpser.DeleteSFTPFolder("/documentstorage/" + ddlDepartment.Text + "/" + txtDocumentType.Text.Replace(" ", "_").Replace(",", "_")); } } else { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("It was not possible to create this Department! If necessary Contact IT Department.", "Error!", this); } }
private void btnAdd_Click(object sender, EventArgs e) { My.MyProject.Forms.frmAddEditStoreFiles.ClearFields(); MdlLoadingSetting.showDialogForm(My.MyProject.Forms.frmAddEditStoreFiles, this); DocumentsStoredTypeBindingSource.DataSource = DocumentsStoredTypeService.GetByDeparmentId(Conversions.ToInteger(ddlArea.SelectedValue)); }
public void LoadDocType() { DocumentsStoredTypeBindingSource.DataSource = DocumentsStoredTypeService.GetByDeparmentId(Convert.ToInt32(ddlArea.SelectedValue)); }
/* TODO ERROR: Skipped EndRegionDirectiveTrivia */ /* TODO ERROR: Skipped RegionDirectiveTrivia */ private void UploadFile() { // Verify max if (txtFileTitle.TextLength > 50) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("The maximum characters for the File Title field is 50.", "File Title", this); return; } if (txtDescription.TextLength > 250) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("The maximum characters for the description field is 250..", "File Title", this); return; } // 0 - Handles possible errors if (string.IsNullOrEmpty(ddlArea.Text)) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Choose a department.", "Department", this); return; } if (string.IsNullOrEmpty(ddlType.Text)) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Choose a Document Type.", "Document Type", this); return; } if (string.IsNullOrEmpty(txtFile.Text)) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Invalid file", "Enter the name and path of the destination file", this); return; } // 1 - Check Form Date Format if (txtIssueDate.CustomFormat == "MMM dd, yyyy") { IssueDate = Conversions.ToString(txtIssueDate.Value); } if (txtExpireDate.CustomFormat == "MMM dd, yyyy") { ExpireDate = Conversions.ToString(txtExpireDate.Value); } // 2 - Name the file DateDoc = DateTime.Now.ToString("dd/MMM/yyyy") + "_" + DateTime.Now.ToString("HH") + "h_" + DateTime.Now.ToString("mm") + "m"; if (string.IsNullOrEmpty(ddlEmployee.Text)) { filename = ddlType.Text.Trim().Replace(" ", "_") + "_" + DateDoc.Replace("/", "_") + ".PDF"; } else { filename = ddlType.Text.Trim() + "_" + ddlEmployee.Text.Trim().Replace("(", "").Replace(")", "_").Replace(" ", "").Replace(",", "_") + "_" + DateDoc.Replace("/", "_") + ".PDF"; } // 3 - Select the file for a specific directory fileOrigin = txtFile.Text; // 4 - file destiny fileDestiny = "documentstorage/" + ddlArea.Text + "/" + ddlType.Text + "/"; waitForm.Show(); // 4.1 - Insert file on server and save to database if (ftpser.uploadSFTPFile(fileOrigin, fileDestiny, filename)) { if (DocumentsStoredService.Insert(txtFileTitle.Text, txtDescription.Text, fileDestiny + filename, IssueDate, ExpireDate, filename, Conversions.ToInteger(ddlEmployee.SelectedValue), Conversions.ToInteger(ddlType.SelectedValue), Conversions.ToInteger(ddlArea.SelectedValue))) { waitForm.Close(); My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("File copied successfully.", "Success", this); DocumentsStoredTypeBindingSource.DataSource = DocumentsStoredTypeService.GetByDeparmentId(Conversions.ToInteger(ddlArea.SelectedValue)); Close(); My.MyProject.Forms.frmStoreFiles.SearchDocs(); } else { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("If the Error persists contact the IT department. Error Code# DB120", "Error sending file", this); ftpser.DeleteSFTPFile(fileDestiny + filename); } } else { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("If the Error persists contact the IT department. Error Code #FTB120", "Error sending file", this); } waitForm.Close(); }
private void ddlArea_SelectedIndexChanged(object sender, EventArgs e) { DocumentsStoredTypeBindingSource.DataSource = DocumentsStoredTypeService.GetByDeparmentId(Conversions.ToInteger(ddlArea.SelectedValue)); }