private void PopulateDescription() { try { switch (this.ENTITY) { case APP_ENTITIES.INVENTORY_ITEM: TBL_MP_Master_Item dbItem = (new ServiceInventoryItems()).GetItemDBRecord(this.ENTITY_ID); if (dbItem != null) { txtDescription.Text = string.Format("{0}\n{1}\nCODE: {2}", dbItem.Item_Name, dbItem.Long_Description, dbItem.ItemCode); } break; case APP_ENTITIES.PARTIES: Tbl_MP_Master_Party dbParty = (new ServiceParties()).GetPartyByPartyID(this.ENTITY_ID); if (dbParty != null) { txtDescription.Text = string.Format("{0} ({1})\n{2}", dbParty.PartyName, dbParty.PartyType, dbParty.PartyCode); } break; case APP_ENTITIES.INVENTORY_ITEM_ATTACHMENT: TBL_MP_Master_Item_Attachments dbItemAttachment = (new ServiceInventoryItems()).GetInventoryItemAttachmentDBRecord(this.ENTITY_ID); if (dbItemAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbItemAttachment.Title.ToUpper(), dbItemAttachment.TBL_MP_Master_Item.Item_Name, dbItemAttachment.TBL_MP_Master_Item.Long_Description); } break; case APP_ENTITIES.APPLICATION_MODULES: Tbl_MP_Master_Module dbModule = (new ServiceModules()).GetModuleDBRecordByID(this.ENTITY_ID); if (dbModule != null) { txtDescription.Text = string.Format("NAME: {0}\nDISPLAY: {1}", dbModule.ModuleName, dbModule.DisplayName); } break; case APP_ENTITIES.MODULES_FORMS: Tbl_MP_Master_Module_Forms dbForm = (new ServiceModules()).GetModuleFormDBRecordByID(this.ENTITY_ID); if (dbForm != null) { txtDescription.Text = string.Format("NAME: {0}\nDISPLAY: {1}", dbForm.FormName, dbForm.DisplayName); } break; case APP_ENTITIES.ROLES: TBL_MP_Master_Role dbRole = (new ServiceRoles()).GetRoleDBRecordByID(this.ENTITY_ID); if (dbRole != null) { txtDescription.Text = string.Format("ROLE NAME: {0}\nROLE NO.: {1}", dbRole.RoleName, dbRole.RoleNo); } break; case APP_ENTITIES.SALES_LEAD_ATTACHMENT: TBL_MP_CRM_SM_SalesLead_Attachment dbLeadAttachment = (new ServiceSalesLead()).GetSalesLeadAttachmentDBRecord(this.ENTITY_ID); if (dbLeadAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbLeadAttachment.Title.ToUpper(), dbLeadAttachment.TBL_MP_CRM_SM_SalesLead.LeadNo, dbLeadAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.SALES_ENQUIRY_ATTACHMENT: TBL_MP_CRM_SalesEnquiry_Attachments dbEnquiryAttachment = (new ServiceSalesEnquiry()).GetSalesEnquiryAttachmentDBRecord(this.ENTITY_ID); if (dbEnquiryAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbEnquiryAttachment.Title.ToUpper(), dbEnquiryAttachment.TBL_MP_CRM_SalesEnquiry.SalesEnquiry_No, dbEnquiryAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.SALES_QUOTATION_ATTACHMENT: TBL_MP_CRM_SalesQuotation_Attachments dbQuoteAttachment = (new ServiceSalesQuotation()).GetSalesQuotationAttachmentDBRecord(this.ENTITY_ID); if (dbQuoteAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbQuoteAttachment.Title.ToUpper(), dbQuoteAttachment.TBL_MP_CRM_SalesQuotation.Quotation_No, dbQuoteAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.SALES_ORDER_ATTACHMENT: TBL_MP_CRM_SalesOrder_Attachment dbOrderAttachment = (new ServiceSalesOrder()).GetSalesOrderAttachmentDBRecord(this.ENTITY_ID); if (dbOrderAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbOrderAttachment.Title.ToUpper(), dbOrderAttachment.TBL_MP_CRM_SalesOrder.SalesOrderNo, dbOrderAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.EMPLOYEES_ATTACHMENT: TBL_MP_Master_Employee_Attachment dbEmpAttachment = (new ServiceEmployee()).GetEmployeeAttachmentDBRecord(this.ENTITY_ID); if (dbEmpAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbEmpAttachment.Title.ToUpper(), dbEmpAttachment.TBL_MP_Master_Employee.EmployeeCode, dbEmpAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.CONTACTS: Tbl_MP_Master_PartyContact_Detail dbContact = (new ServiceContacts()).GetContactID(this.ENTITY_ID); if (dbContact != null) { txtDescription.Text = string.Format("Contact Person Name : {0}\nAddress:{1}\nMobile No:{2}\nAt.Telephone No:{3}\nEmail ID:{4}\n FAX NO:{5}", dbContact.ContactPersoneName, dbContact.Address, dbContact.MobileNo, dbContact.TelephoneNo, dbContact.EmailID, dbContact.FaxNo); } break; } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "frmDelete::PopulateDescription", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void PopulateDocumentViewer() { try { switch (this.SELECTED_ENTITY_TYPE) { case APP_ENTITIES.INVENTORY_ITEM_ATTACHMENT: TBL_MP_Master_Item_Attachments itemAttachment = (new ServiceInventoryItems()).GetInventoryItemAttachmentDBRecord(this.SelectedAttachmentID); _docViewer = new ctrlDocumentViewer(APP_ENTITIES.INVENTORY_ITEM, (int)itemAttachment.FK_Inventory_Item_ID); _docViewer.FileTitle = itemAttachment.Title; _docViewer.ReadOnly = true; _docViewer.ShowDocument(this.SelectedAttachmentPath, this.SelectedAttachmentID); splitContainerMain.Panel2.Controls.Clear(); splitContainerMain.Panel2.Controls.Add(_docViewer); _docViewer.Dock = DockStyle.Fill; break; case APP_ENTITIES.SALES_LEAD_ATTACHMENT: TBL_MP_CRM_SM_SalesLead_Attachment leadAttachment = (new ServiceSalesLead()).GetSalesLeadAttachmentDBRecord(this.SelectedAttachmentID); _docViewer = new ctrlDocumentViewer(APP_ENTITIES.SALES_LEAD, (int)leadAttachment.FK_SalesLeadID); _docViewer.FileTitle = leadAttachment.Title; _docViewer.ReadOnly = true; _docViewer.ShowDocument(this.SelectedAttachmentPath, this.SelectedAttachmentID); splitContainerMain.Panel2.Controls.Clear(); splitContainerMain.Panel2.Controls.Add(_docViewer); _docViewer.Dock = DockStyle.Fill; break; case APP_ENTITIES.SALES_ENQUIRY_ATTACHMENT: TBL_MP_CRM_SalesEnquiry_Attachments EnqAttachment = (new ServiceSalesEnquiry()).GetSalesEnquiryAttachmentDBRecord(this.SelectedAttachmentID); _docViewer = new ctrlDocumentViewer(APP_ENTITIES.SALES_ENQUIRY, (int)EnqAttachment.FK_SalesEnquiryID); _docViewer.FileTitle = EnqAttachment.Title; _docViewer.ReadOnly = true; _docViewer.ShowDocument(this.SelectedAttachmentPath, this.SelectedAttachmentID); splitContainerMain.Panel2.Controls.Clear(); splitContainerMain.Panel2.Controls.Add(_docViewer); _docViewer.Dock = DockStyle.Fill; break; case APP_ENTITIES.SALES_QUOTATION_ATTACHMENT: TBL_MP_CRM_SalesQuotation_Attachments QuotAttachment = (new ServiceSalesQuotation()).GetSalesQuotationAttachmentDBRecord(this.SelectedAttachmentID); _docViewer = new ctrlDocumentViewer(APP_ENTITIES.SALES_QUOTATION, (int)QuotAttachment.FK_SalesQuotationID); _docViewer.FileTitle = QuotAttachment.Title; _docViewer.ReadOnly = true; _docViewer.ShowDocument(this.SelectedAttachmentPath, this.SelectedAttachmentID); splitContainerMain.Panel2.Controls.Clear(); splitContainerMain.Panel2.Controls.Add(_docViewer); _docViewer.Dock = DockStyle.Fill; break; case APP_ENTITIES.SALES_ORDER_ATTACHMENT: TBL_MP_CRM_SalesOrder_Attachment OrderAttachment = (new ServiceSalesOrder()).GetSalesOrderAttachmentDBRecord(this.SelectedAttachmentID); _docViewer = new ctrlDocumentViewer(APP_ENTITIES.SALES_ORDER, (int)OrderAttachment.FK_SalesOrderID); _docViewer.FileTitle = OrderAttachment.Title; _docViewer.ReadOnly = true; _docViewer.ShowDocument(this.SelectedAttachmentPath, this.SelectedAttachmentID); splitContainerMain.Panel2.Controls.Clear(); splitContainerMain.Panel2.Controls.Add(_docViewer); _docViewer.Dock = DockStyle.Fill; break; case APP_ENTITIES.EMPLOYEES_ATTACHMENT: TBL_MP_Master_Employee_Attachment EmpAttachment = (new ServiceEmployee()).GetEmployeeAttachmentDBRecord(this.SelectedAttachmentID); _docViewer = new ctrlDocumentViewer(APP_ENTITIES.EMPLOYEES, (int)EmpAttachment.FK_EmployeeId); _docViewer.FileTitle = EmpAttachment.Title; _docViewer.ReadOnly = true; _docViewer.ShowDocument(this.SelectedAttachmentPath, this.SelectedAttachmentID); splitContainerMain.Panel2.Controls.Clear(); splitContainerMain.Panel2.Controls.Add(_docViewer); _docViewer.Dock = DockStyle.Fill; break; } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(ex.Message, "pageDeletedAttachments::PopulateDocumentViewer", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEdit_Click(object sender, EventArgs e) { try { string serverPath = string.Empty; string strTitle = string.Empty; int DocCategoryID = 0; // GET VALUES TO BE DISPLAYED IN ATTACHMENT EDIT FORM switch (this.ENTITY) { case APP_ENTITIES.SALES_LEAD: TBL_MP_CRM_SM_SalesLead_Attachment objLead = (new ServiceSalesLead()).GetSalesLeadAttachmentDBRecord(SelectedAttachmentID); if (objLead != null) { DocCategoryID = (int)objLead.FK_CategoryID; strTitle = objLead.Title; } break; case APP_ENTITIES.SALES_ENQUIRY: TBL_MP_CRM_SalesEnquiry_Attachments objEnquiry = (new ServiceSalesEnquiry()).GetSalesEnquiryAttachmentDBRecord(SelectedAttachmentID); if (objEnquiry != null) { DocCategoryID = (int)objEnquiry.FK_CategoryID; strTitle = objEnquiry.Title; } break; case APP_ENTITIES.SALES_QUOTATION: TBL_MP_CRM_SalesQuotation_Attachments objQuotation = (new ServiceSalesQuotation()).GetSalesQuotationAttachmentDBRecord(SelectedAttachmentID); if (objQuotation != null) { DocCategoryID = (int)objQuotation.FK_CategoryID; strTitle = objQuotation.Title; } break; case APP_ENTITIES.SALES_ORDER: TBL_MP_CRM_SalesOrder_Attachment objOrder = (new ServiceSalesOrder()).GetSalesOrderAttachmentDBRecord(SelectedAttachmentID); if (objOrder != null) { DocCategoryID = (int)objOrder.FK_CategoryID; strTitle = objOrder.Title; } break; case APP_ENTITIES.INVENTORY_ITEM: TBL_MP_Master_Item_Attachments objItem = (new ServiceInventoryItems()).GetInventoryItemAttachmentDBRecord(SelectedAttachmentID); if (objItem != null) { DocCategoryID = (int)objItem.FK_CategoryID; strTitle = objItem.Title; } break; case APP_ENTITIES.EMPLOYEES: TBL_MP_Master_Employee_Attachment objEmp = (new ServiceEmployee()).GetEmployeeAttachmentDBRecord(SelectedAttachmentID); if (objEmp != null) { DocCategoryID = (int)objEmp.FK_CategoryID; strTitle = objEmp.Title; } break; } // OPEN ATTACHMENT FORM FOR EDITING frmNewAttachment frm = new frmNewAttachment(); frm.CategoryID = DocCategoryID; frm.Title = strTitle; frm.OpenForEditing = true; if (frm.ShowDialog() == DialogResult.OK) { switch (this.ENTITY) { case APP_ENTITIES.SALES_LEAD: (new ServiceSalesLead()).UpdateSalesLeadAttachment(SelectedAttachmentID, frm.CategoryID, frm.Title, frm.AttachedFilePath, Program.CURR_USER.EmployeeID); break; case APP_ENTITIES.SALES_ENQUIRY: (new ServiceSalesEnquiry()).UpdateSalesEnquiryAttachment(SelectedAttachmentID, frm.CategoryID, frm.Title, frm.AttachedFilePath, Program.CURR_USER.EmployeeID); break; case APP_ENTITIES.SALES_QUOTATION: (new ServiceSalesQuotation()).UpdateSalesQuotationAttachment(SelectedAttachmentID, frm.CategoryID, frm.Title, frm.AttachedFilePath, Program.CURR_USER.EmployeeID); break; case APP_ENTITIES.SALES_ORDER: (new ServiceSalesOrder()).UpdateSalesOrderAttachment(SelectedAttachmentID, frm.CategoryID, frm.Title, frm.AttachedFilePath, Program.CURR_USER.EmployeeID); break; case APP_ENTITIES.INVENTORY_ITEM: (new ServiceInventoryItems()).UpdateInventoryItemAttachment(SelectedAttachmentID, frm.CategoryID, frm.Title, frm.AttachedFilePath, Program.CURR_USER.EmployeeID); break; case APP_ENTITIES.EMPLOYEES: (new ServiceEmployee()).UpdateEmployeeAttachment(SelectedAttachmentID, frm.CategoryID, frm.Title, frm.AttachedFilePath, Program.CURR_USER.EmployeeID); break; } this.PopulateDocuments(); } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ctrlAttachment::btnEdit_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void OnAttachmentSelectionChange() { try { if (this.SelectedAttachmentID != 0) { btnUndeleteAtachment.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True; } switch (this.SELECTED_ENTITY_TYPE) { case APP_ENTITIES.INVENTORY_ITEM_ATTACHMENT: TBL_MP_Master_Item_Attachments itemAttachment = (new ServiceInventoryItems()).GetInventoryItemAttachmentDBRecord(this.SelectedAttachmentID); if (itemAttachment != null) { headerGroupDeleteInfo.ValuesPrimary.Heading = string.Format("DELETED BY {0} DT. {1}", ServiceEmployee.GetEmployeeNameByID((int)itemAttachment.DeletedBy), itemAttachment.DeleteDatetime.Value.ToString("dd MMM yy hh:mmtt")); txtDeleteRemark.Text = itemAttachment.DeleteRemarks; } break; case APP_ENTITIES.SALES_LEAD_ATTACHMENT: TBL_MP_CRM_SM_SalesLead_Attachment LeadAttachment = (new ServiceSalesLead()).GetSalesLeadAttachmentDBRecord(this.SelectedAttachmentID); if (LeadAttachment != null) { headerGroupDeleteInfo.ValuesPrimary.Heading = string.Format("DELETED BY {0} DT. {1}", ServiceEmployee.GetEmployeeNameByID((int)LeadAttachment.DeletedBy), LeadAttachment.DeleteDatetime.Value.ToString("dd MMM yy hh:mmtt")); txtDeleteRemark.Text = LeadAttachment.DeleteRemarks; } break; case APP_ENTITIES.SALES_ENQUIRY_ATTACHMENT: TBL_MP_CRM_SalesEnquiry_Attachments EnqAttachment = (new ServiceSalesEnquiry()).GetSalesEnquiryAttachmentDBRecord(this.SelectedAttachmentID); if (EnqAttachment != null) { headerGroupDeleteInfo.ValuesPrimary.Heading = string.Format("DELETED BY {0} DT. {1}", ServiceEmployee.GetEmployeeNameByID((int)EnqAttachment.DeletedBy), EnqAttachment.DeletedDatetime.Value.ToString("dd MMM yy hh:mmtt")); txtDeleteRemark.Text = EnqAttachment.DeleteRemarks; } break; case APP_ENTITIES.SALES_QUOTATION_ATTACHMENT: TBL_MP_CRM_SalesQuotation_Attachments QuotAttachment = (new ServiceSalesQuotation()).GetSalesQuotationAttachmentDBRecord(this.SelectedAttachmentID); if (QuotAttachment != null) { headerGroupDeleteInfo.ValuesPrimary.Heading = string.Format("DELETED BY {0} DT. {1}", ServiceEmployee.GetEmployeeNameByID((int)QuotAttachment.DeletedBy), QuotAttachment.DeletedDatetime.Value.ToString("dd MMM yy hh:mmtt")); txtDeleteRemark.Text = QuotAttachment.DeleteRemarks; } break; case APP_ENTITIES.SALES_ORDER_ATTACHMENT: TBL_MP_CRM_SalesOrder_Attachment OrderAttachment = (new ServiceSalesOrder()).GetSalesOrderAttachmentDBRecord(this.SelectedAttachmentID); if (OrderAttachment != null) { headerGroupDeleteInfo.ValuesPrimary.Heading = string.Format("DELETED BY {0} DT. {1}", ServiceEmployee.GetEmployeeNameByID((int)OrderAttachment.DeletedBy), OrderAttachment.DeleteDatetime.Value.ToString("dd MMM yy hh:mmtt")); txtDeleteRemark.Text = OrderAttachment.DeleteRemarks; } break; case APP_ENTITIES.EMPLOYEES_ATTACHMENT: TBL_MP_Master_Employee_Attachment EmpAttachment = (new ServiceEmployee()).GetEmployeeAttachmentDBRecord(this.SelectedAttachmentID); if (EmpAttachment != null) { headerGroupDeleteInfo.ValuesPrimary.Heading = string.Format("DELETED BY {0} DT. {1}", ServiceEmployee.GetEmployeeNameByID((int)EmpAttachment.DeletedBy), EmpAttachment.DeleteDatetime.Value.ToString("dd MMM yy hh:mmtt")); txtDeleteRemark.Text = EmpAttachment.DeleteRemarks; } break; } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("msg")) { PopulateOutlookViewer(); } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("pdf")) { PopulateDocumentViewer(); } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("jpg")) { PopulateDocumentViewer(); } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("jpeg")) { PopulateDocumentViewer(); } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("png")) { PopulateDocumentViewer(); } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("gif")) { PopulateDocumentViewer(); } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("docx")) { PopulateDocumentViewer(); } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("doc")) { PopulateDocumentViewer(); } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("xls")) { PopulateDocumentViewer(); } if (this.SelectedAttachmentPath.Trim().ToLower().EndsWith("xlsx")) { PopulateDocumentViewer(); } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(ex.Message, "pageDeletedAttachments::OnAttachmentSelectionChange", MessageBoxButtons.OK, MessageBoxIcon.Error); } }