public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rpt_banks rpt = new rpt_banks(); rpt.Site = this.Site; return(rpt); }
private void performButtons(xEnums.PerformanceType xenum) { switch (xenum) { case xEnums.PerformanceType.View: if (ActiveControl.Name.Trim() == txt_bankcode.Name.Trim()) { int length = Convert.ToInt32(ConfigurationManager.AppSettings["BankFieldLength"]); string[] strSearchField = new string[length]; string strSQL = ConfigurationManager.AppSettings["BankSQL"].ToString(); for (int i = 0; i < length; i++) { string m; m = i.ToString(); strSearchField[i] = ConfigurationManager.AppSettings["BankField" + m + ""].ToString(); } frmU_Search find = new frmU_Search(strSQL, strSearchField, this); find.ShowDialog(this); } break; case xEnums.PerformanceType.New: FunctionButtonStatus(xEnums.PerformanceType.New); formMode = 1; txt_bankcode.Focus(); break; case xEnums.PerformanceType.Edit: FunctionButtonStatus(xEnums.PerformanceType.Edit); formMode = 2; txt_name.Focus(); break; case xEnums.PerformanceType.Save: if (txt_bankcode.Text.Trim() == "") { errorProvider1.SetError(txt_bankcode, "Please enter a bank Code !"); return; } if (txt_name.Text.Trim() == "") { errorProvider1.SetError(txt_name, "Please enter a bank name !"); return; } if (formMode == 1) { if (M_BankDL.ExistingBank(txt_bankcode.Text.Trim())) { UserDefineMessages.ShowMsg("The bank code you have entered already exists!", UserDefineMessages.Msg_Warning); return; } if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes) { M_Bank objbank = new M_Bank(); objbank.BANK_CODE = txt_bankcode.Text.Trim(); objbank.BANK_NAME = txt_name.Text.Trim().ToUpper(); M_BankDL bal = new M_BankDL(); bal.SaveBankSP(objbank, 1); GetData(); FunctionButtonStatus(xEnums.PerformanceType.Save); commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2); } } else if (formMode == 2) { if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes) { M_Bank objbank = new M_Bank(); objbank.BANK_CODE = txt_bankcode.Text.Trim(); objbank.BANK_NAME = txt_name.Text.Trim().ToUpper(); M_BankDL bal = new M_BankDL(); bal.SaveBankSP(objbank, 3); GetData(); FunctionButtonStatus(xEnums.PerformanceType.Save); commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2); } } break; case xEnums.PerformanceType.Cancel: FunctionButtonStatus(xEnums.PerformanceType.Default); break; case xEnums.PerformanceType.Print: string reporttitle = "List of All Banks".ToUpper(); frm_reportViwer rpt = new frm_reportViwer(); rpt.MdiParent = MDI_SMartAnything.ActiveForm; rpt.FormHeadertext = reporttitle; ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); paramFields = commonFunctions.AddCrystalParams(reporttitle, commonFunctions.Loginuser); rpt_banks rptBank = new rpt_banks(); M_BankDL bankdlx = new M_BankDL(); rptBank.SetDataSource(bankdlx.SelectAllBanks()); rpt.RepViewer.ParameterFieldInfo = paramFields; rpt.RepViewer.ReportSource = rptBank; rpt.RepViewer.Refresh(); rpt.Show(); break; } }