private void DisplayReport(DataTable dt) { string fromDate = ((DateTime)dtbFrom.DateValue).ToString("dd/MM/yyyy"); string toDate = ToDate.ToString("dd/MM/yyyy"); string periode = String.Format("Periode {0} s/d {1}", fromDate, toDate); //construct parameter List <ReportParameter> rptParams = new List <ReportParameter>(); rptParams.Add(new ReportParameter("Periode", periode)); rptParams.Add(new ReportParameter("UserName", SecurityManager.UserName)); rptParams.Add(new ReportParameter("KodeCabang", GlobalVar.CabangID)); rptParams.Add(new ReportParameter("NamaToko", this.namaToko)); rptParams.Add(new ReportParameter("AlamatToko", this.alamatToko)); rptParams.Add(new ReportParameter("Kota", this.kotaToko)); rptParams.Add(new ReportParameter("IdWil", this.wilID)); rptParams.Add(new ReportParameter("KodeToko", this.kodeToko)); rptParams.Add(new ReportParameter("Kelompok", string.Empty)); frmReportViewer ifrmReport = new frmReportViewer("SIP.rptProgresSKUToko.rdlc", rptParams, dt, "dsProgresSKUToko_Data"); ifrmReport.Text = "Report"; ifrmReport.Show(); }
private void ButtonPrint_OnClick(object sender, RoutedEventArgs e) { if (Logs.Count == 0) { MessageBox.Show("No Data."); return; } var myPicturePath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); var fileName = string.Format("{0}.jpg", Guid.NewGuid().ToString()); var filePath = System.IO.Path.Combine(myPicturePath, fileName); Chart.ExportToImage(filePath); string itemName = Logs[0].Item.ItemName; var export = new LogExport() { ItemName = itemName, StartDate = FromDate.ToString(), EndDate = ToDate.ToString(), Graph = string.Format("File://{0}", filePath), HashValue = ConcatedHash, Min = Min.ToString(), Max = Max.ToString() }; WindowReport1 windowReport1 = new WindowReport1(); windowReport1.Export = export; windowReport1.ShowDialog(); // clean junk File.Delete(filePath); }
public override string ToString() { string formatString = "yyyy-MM-dd HH:mm"; return("from " + FromDate.DayOfWeek.ToString() + " " + FromDate.ToString(formatString) + " to " + ToDate.DayOfWeek.ToString() + " " + ToDate.ToString(formatString)); }
public bool IsValid() { var oErrors = new List <string>(); if (ToDate <= FromDate) { oErrors.Add("Period final date is less than period start date in " + FromDate.ToString("dd-MM-yyyy", CultureInfo.InvariantCulture) + " and " + ToDate.ToString("dd-MM-yyyy", CultureInfo.InvariantCulture) + "." ); } // if if (string.IsNullOrWhiteSpace(Period)) { Period = ToDate.ToString("MM yy", CultureInfo.InvariantCulture); } if (DueDate < ToDate) { DueDate = ToDate.AddMonths(1).AddDays(7); } if ((BoxData == null) || (BoxData.Count < 1)) { oErrors.Add("No box data specified."); } Errors = oErrors.ToArray(); return(Errors.Length == 0); } // IsValid
public JsonResult GetHolidayList() { int totalRow = 0; string fromDate = Request.QueryString["fromDate"]; string toDate = Request.QueryString["toDate"]; DateTime FromDate; DateTime ToDate; if (string.IsNullOrWhiteSpace(fromDate)) { var a = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd"); FromDate = DateTime.ParseExact(a, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); } else { FromDate = DateTime.ParseExact(fromDate, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); } if (string.IsNullOrWhiteSpace(toDate)) { ToDate = DateTime.ParseExact(DateTime.Now.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); } else { ToDate = DateTime.ParseExact(toDate, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); } var page = GetPagingMessage(Request.QueryString); int result = DateTime.Compare(ToDate, FromDate); if (result < 0) { return(Json(new { status = false, mess = "Ngày bắt đầu không thể lớn hơn ngày kết thúc.", }, JsonRequestBehavior.AllowGet)); } var regulationTime = _iplHoliday.ListHolidayAllPaging(FromDate, ToDate, page.PageIndex, page.PageSize, ref totalRow); ViewBag.FromDate = FromDate.ToString("yyyy-MM-dd"); ViewBag.ToDate = ToDate.ToString("yyyy-MM-dd"); if (regulationTime != null && regulationTime.Count() > 0) { return(Json(new { status = true, rows = regulationTime.ToList(), }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = false, mess = "Không tìm thấy dữ liệu.", }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// Valids the data. /// </summary> /// <returns></returns> protected override bool ValidData() { //if (cboActivityID.SelectedIndex == 1) //{ // // grdLookUpBudgetItemID.Enabled = false; // if ( grdLookUpWaitBudgetSourceID.EditValue == null) // { // XtraMessageBox.Show("Ban chua chon khoan thu", // ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error); // grdLookUpWaitBudgetSourceID.Focus(); // return false; // } //} //if (cboActivityID.SelectedIndex == 2) //{ // if (grdLookUpWaitBudgetSourceID.EditValue == null) // { // XtraMessageBox.Show("Ban chua chon quy ", // ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error); // grdLookUpWaitBudgetSourceID.Focus(); // return false; // } //} if (string.IsNullOrEmpty(CapitalAllocateCode)) { XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResEmptyCapitalAllocateCode"), ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error); txtCapitalAllocateCode.Focus(); return(false); } if (string.IsNullOrEmpty(BudgetSourceCode)) { XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResEmptyCapitalAllocateByBudgetSourceCode"), ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error); grdLookUpBudgetSourceID.Focus(); return(false); } if (string.IsNullOrEmpty(FromDate.ToString())) { XtraMessageBox.Show("Bạn chưa nhập ngày bắt đầu áp dụng chỉ tiêu", ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error); dtFromDate.Focus(); return(false); } if (string.IsNullOrEmpty(ToDate.ToString())) { XtraMessageBox.Show("Bạn chưa nhập ngày kết thúc áp dụng chỉ tiêu", ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error); dtToDate.Focus(); return(false); } return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ToDate = DateTime.Now.AddDays(-DaysCount); FromDate = DateTime.Now; txtfrmdate.Text = ToDate.ToString("MM/dd/yyyy"); txttodate.Text = FromDate.ToString("MM/dd/yyyy"); BindConsignmentGrid(); } }
public override string ToString() { return("Reservation confirmation #" + ReservationId.ToString() + " is for " + Name.PadRight(7) + " \n at " + ParkName + " park and at " + CampgroundName + " campground (#" + CampgroundId + ") at site #" + SiteId.ToString().PadRight(3) + "\n from " + FromDate.ToString("D") + " to " + ToDate.ToString("D") + " and was created on " + CreateDate.ToString("D") + "\n Total Cost is of stay: " + String.Format("{0:C2}", ((ToDate - FromDate).Days * DailyFee))); }
private string GenerateSQL() { StringBuilder sb = new StringBuilder(); //sb.Append(SQLCommands.AllJobs); sb.Append(" WHERE CustomerName Like '%" + CustomerName + "%'"); sb.Append(" AND DocketNo Like '%" + PrismNo + "%'"); sb.Append(" AND JobStatusId = 3"); sb.Append(" AND JobCompletedDate >=#" + FromDate.ToString("dd MMM yyyy") + "#"); sb.Append(" AND JobCompletedDate <=#" + ToDate.ToString("dd MMM yyyy") + "#"); sb.Append(" ORDER BY " + SortColumnName + " " + SortOrder); return(sb.ToString()); }
private string GenerateSQL() { StringBuilder sb = new StringBuilder(); sb.Append(SQLCommands.AllJobs); sb.Append(" WHERE CustomerName Like '%" + CustomerName + "%'"); sb.Append(" AND Programmer Like '%" + DeveloperName + "%'"); sb.Append(" AND CampaignManager Like '%" + CampaignManagerName + "%'"); sb.Append(" AND JobStatusId = 3"); sb.Append(" AND JobCompletedDate >=#" + FromDate.ToString("dd MMM yyyy") + "#"); sb.Append(" AND JobCompletedDate <=#" + ToDate.ToString("dd MMM yyyy") + "#"); sb.Append(" ORDER BY " + SortColumnName + " " + SortOrder); return(sb.ToString()); }
public IList <KeyValuePair <string, string> > GetValues() { return(new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("Invoice Id", InvoiceId), new KeyValuePair <string, string>("Customer Code", CustomerCode), new KeyValuePair <string, string>("Name", Name), new KeyValuePair <string, string>("From Date", FromDate.ToString()), new KeyValuePair <string, string>("To Date", ToDate.ToString()), new KeyValuePair <string, string>("Invoice Value", InvoiceValue.ToString()), new KeyValuePair <string, string>("Created User", CreatedUser), new KeyValuePair <string, string>("Created Date", CreatedDate), new KeyValuePair <string, string>("Last Updated User", LuUser), new KeyValuePair <string, string>("Last Updated Date", LuDate) }); }
public string ToString() { StringBuilder sb = new StringBuilder(); if (FromDateTime != null) { sb.Append(FromDate.ToString()); } if (ToDateTime != null) { if (sb.Length > 0) { sb.Append(Resources.FromTo); } sb.Append(ToDate.ToString()); } return(sb.ToString()); }
internal PayrollRequest GetEmployeeRequest(PayrollEncoder encoder, object[] args) { var requestBody = new JsonDoc() .Set("ClientCode", encoder.Encode(ClientCode)) .Set("EmployeeId", EmployeeId) .Set("ActiveEmployeeOnly", Active) .Set("EmployeeOffset", EmployeeOffset) .Set("EmployeeCount", EmployeeCount) .Set("FromDate", FromDate?.ToString("MM/dd/yyyy HH:mm:ss")) .Set("ToDate", ToDate?.ToString("MM/dd/yyyy HH:mm:ss")) .Set("PayTypeCode", EnumConverter.GetDescription(PayTypeCode)) .ToString(); return(new PayrollRequest { Endpoint = (EmployeeId != null) ? "/api/pos/employee/GetEmployee" : "/api/pos/employee/GetEmployees", RequestBody = requestBody }); }
public void HienThiBaoCao8STheoDonVi() { string pDepartmentID = (string)Request["DepartmentID"]; string pFromDate = (string)Request["FromDate"]; string pToDate = (string)Request["ToDate"]; DateTime FromDate; DateTime ToDate; try { FromDate = DateTime.Parse(pFromDate); ToDate = DateTime.Parse(pToDate); } catch { FromDate = DateTime.Today.AddDays(-7); ToDate = DateTime.Today; } List <string> Path = new List <string>(); string pathA = ConfigurationManager.AppSettings["attactFile"].ToString(); string pathServer = pathA + @"\crtBaoCaoTuan_Excel.rpt"; Path.Add(@"~/Report/CrystalReport4.rpt"); Hashtable htb = new Hashtable(); DataSet ds = new DataSet(); DataSet ds1 = new DataSet(); DataSet ds2 = new DataSet(); DataSet ds3 = new DataSet(); htb.Add("depid", pDepartmentID); htb.Add("FromDate", FromDate.ToString("dd/MM/yyyy")); htb.Add("ToDate", ToDate.ToString("dd/MM/yyyy")); ds1 = dalItem8S.QryDiem8STheoDonVi(FromDate, ToDate, pDepartmentID); ds2 = dalItem8S.LayItem8SVN(); ds3 = dalItem8S.LayDiem8SCH(); ds.Merge(ds1); ds.Merge(ds2); ds.Merge(ds3); if (ds1.Tables.Count > 0) { ShowExecl(Path, ds, htb); } }
/// <summary> /// send amil function that sends with smtp server. /// </summary> public void SendMail() { MailMessage mail = new MailMessage(); mail.To.Add(this.ToEmailAdd); mail.Priority = MailPriority.High; mail.From = new MailAddress("*****@*****.**"); mail.Subject = " הצעת אירוח עבור בקשה מס: " + Request.Key; mail.Body = (@"<body style='margin: 0px;'> <div style='width:5; height:200; padding:10px; border-radius:10px; direction:rtl; border:solid 2px #C0C0C0;'> <span>שלום וברכה !</span><br /> <span>שמי : </span> <span>" + HostName + @"</span><br /> <span>אני רוצה להציע לך את יחידת האירוח שלי - <span> <span>" + Unit.HostingUnitName + @"</span><br /> <span>שנמצאת ב -</span> <span>" + Unit.Area + @"</span><br /> <span>מתאריך : </span> <span>" + FromDate.ToString(format: "dd/MM/yyyy") + @"</span><br /> <span>עד תאריך :</span> <span>" + ToDate.ToString(format: "dd/MM/yyyy") + @"</span><br /> <span>כפי בקשתך.</span><br /> <span>אם הצעה זו עדיין רלוונטי בשבילך, אשמח שתחזיר לי תשובה למייל : </span> <span>" + FromEmailAdd + @"</span><br /> <span>תודה רבה ושיהיה לך יום נפלא !</span><br /> </div> </body>"); mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential("avrumi2018", "Aa5711268!"); smtp.EnableSsl = true; try { smtp.Send(mail); } catch (ArgumentNullException ex) { throw ex; } catch (InvalidOperationException ex) { throw ex; } catch (SmtpException ex) { throw ex; } }
public TOVehicleReservation ToTO() { TOVehicleReservation toVehicleReservation = new TOVehicleReservation(); toVehicleReservation.FromDate = FromDate.ToString(); toVehicleReservation.FromLocation = FromLocation; toVehicleReservation.NumOfDays = NumOfDays; toVehicleReservation.Price = Price; toVehicleReservation.ReservationId = ReservationId; toVehicleReservation.ToDate = ToDate.ToString(); toVehicleReservation.ToLocation = ToLocation; toVehicleReservation.Type = Type; //toVehicleReservation.Vehicle = Vehicle.ToTO(); toVehicleReservation.VehicleId = VehicleId; toVehicleReservation.CreationDate = CreationDate.ToString(); toVehicleReservation.IsVehicleRated = IsVehicleRated; toVehicleReservation.IsRentACarRated = IsRentACarRated; return(toVehicleReservation); }
private void Get_tryDate() { var xmlEntityReplacements = new Dictionary <string, string> { { "'", "'" }, { "<", "<" }, { ">", ">" }, { """, "\"" }, }; string req = "SELECT * from request where STR_TO_DATE(date, \"%d.%m.%Y %k:%i\") between STR_TO_DATE('" + FromDate.ToString("dd.MM.yyyy") + " 00:00', \"%d.%m.%Y %k:%i\") and STR_TO_DATE('" + ToDate.ToString("dd.MM.yyyy") + " 23:59:59', \"%d.%m.%Y %k:%i:%s\"); "; DT_ALL = clsDB.Get_DataTable(req); foreach (DataRow row in DT_ALL.Rows) { //Get_Content = Convert.ToString(row["content"]); row["content"] = Regex.Replace(row["content"].ToString(), @"<(.|\n)*?>", String.Empty); row["content"] = Regex.Replace(row["content"].ToString(), String.Join("|", xmlEntityReplacements.Keys.Select(k => k.ToString()).ToArray()), m => xmlEntityReplacements[m.Value]); } clsDB.Close_DB_Connection(); ///// long totalMemory = GC.GetTotalMemory(false); GC.Collect(); GC.Collect(1, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); ///// }
protected void btnShowReport_Click(object sender, EventArgs e) { if (!sec.UserRight("2585", "006")) { Response.Redirect("~/Test.aspx"); } SqlDataReader rder; ReportDocument RD = new ReportDocument(); DataTable dt = new DataTable(); DateTime FromDate; DateTime ToDate; if (dtFrom.Text == "" || dtTo.Text == "") { lblMSG.Text = "Please select dates"; return; } string FDate = myFunc.SaveDate(dtFrom.Text).ToString(); string TDate = myFunc.SaveDate(dtTo.Text).ToString(); FromDate = Convert.ToDateTime(FDate); ToDate = Convert.ToDateTime(TDate); DXBMS.Data.DataSet1 objDsReports = new Data.DataSet1(); if (rbStatus.SelectedItem.Text == "GST") { SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char, 5), //0 new SqlParameter("@FromDate", SqlDbType.DateTime), //0 new SqlParameter("@ToDate", SqlDbType.DateTime), //0 }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = FromDate.ToString("yyyy-MM-dd"); param[2].Value = ToDate.ToString("yyyy-MM-dd"); string sql = "exec SP__Get_rptGSTDetailReport '" + Session["DealerCode"].ToString() + "','" + FromDate.ToString("yyyy-MM-dd") + "','" + ToDate.ToString("yyyy-MM-dd") + "'"; dt = myFunc.GetData(sql); RD.PrintOptions.PaperSize = PaperSize.PaperA4; RD.Load(Server.MapPath("../GSTDetailReport.rpt")); } else if (rbStatus.SelectedItem.Text == "Combine") { SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char, 5), //0 new SqlParameter("@FromDate", SqlDbType.DateTime), //0 new SqlParameter("@ToDate", SqlDbType.DateTime), //0 }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = FromDate.ToString("yyyy-MM-dd"); param[2].Value = ToDate.ToString("yyyy-MM-dd"); string sql = "exec SP__Get_rptComDetailReport '" + Session["DealerCode"].ToString() + "','" + FromDate.ToString("yyyy-MM-dd") + "','" + ToDate.ToString("yyyy-MM-dd") + "'"; dt = myFunc.GetData(sql); RD.PrintOptions.PaperSize = PaperSize.PaperA4; RD.Load(Server.MapPath("../ConbineTaxDetail.rpt")); } else { SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char, 5), //0 new SqlParameter("@FromDate", SqlDbType.DateTime), //0 new SqlParameter("@ToDate", SqlDbType.DateTime), //0 }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = FromDate.ToString("yyyy-MM-dd"); param[2].Value = ToDate.ToString("yyyy-MM-dd"); string sql = "exec SP__Get_rptPSTDetailReport '" + Session["DealerCode"].ToString() + "','" + FromDate.ToString("yyyy-MM-dd") + "','" + ToDate.ToString("yyyy-MM-dd") + "'"; dt = myFunc.GetData(sql); RD.PrintOptions.PaperSize = PaperSize.PaperA4; RD.Load(Server.MapPath("../PSTDetailReport.rpt")); } RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerFax"].Text = "'" + Session["DealerFax"].ToString() + "'"; RD.DataDefinition.FormulaFields["NTN"].Text = "'N.T.N # " + Session["DealerNTN"].ToString() + "'"; RD.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No. " + Session["DealerSaleTaxNo"].ToString() + " '"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserID"].ToString() + "'"; RD.DataDefinition.FormulaFields["FromCode"].Text = "'" + FDate + "'"; RD.DataDefinition.FormulaFields["ToCode"].Text = "'" + TDate + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; if (rbStatus.SelectedItem.Text == "PST") { RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "PST Collection" + "\""; } else if (rbStatus.SelectedItem.Text == "Combine") { RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Combine Tax Collection" + "\""; } else { RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "GST Collection" + "\""; } RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; RD.SetDataSource(dt); // Session["RD"]=RD; //// convert and show string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; Session["RD"] = RD; string URL; URL = "../../../../Download/OpenPdf.aspx?ReportID=" + FileName; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); //string FilePath = Server.MapPath("~") + "\\Download\\"; //string FileName = "Report.pdf"; //string File = FilePath + FileName; //PdfDocument outputDocument = new PdfDocument(); //Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); //stream.Seek(0, SeekOrigin.Begin); //DirectoryInfo info = new DirectoryInfo(FilePath); //if (!info.Exists) //{ // info.Create(); //} //string path = Path.Combine(FilePath, FileName); //using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) //{ // stream.CopyTo(outputFileStream); //} //stream.Dispose(); stream.Close(); //string URL = "../../../../Download/PrintReport.aspx"; //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
private void ExecutePrint(object obj) { GlobalClass.ReportName = "Transaction Activity Log"; GlobalClass.ReportParams = string.Format("From Date : {0} To {1}", FromDate.ToString("MM/dd/yyyy"), ToDate.ToString("MM/dd/yyyy")); rv.Report.PrintSettings.PrintPageMargin = new Thickness(30); rv.Report.PrintSettings.AllowColumnWidthFitToPrintPage = false; rv.Report.Print(); }
protected void btnShowReport_Click(object sender, EventArgs e) { if (dtFrom.Text == "" || dtTo.Text == "") { lblMSG.Text = "Please select dates"; return; } SqlDataReader rder; ReportDocument RD = new ReportDocument(); DateTime FromDate; DateTime ToDate; string FDate = dtFrom.Date.ToString("yyyy/MM/dd"); string TDate = dtTo.Date.ToString("yyyy/MM/dd"); FromDate = Convert.ToDateTime(FDate); ToDate = Convert.ToDateTime(TDate); //ReportDocument RD = new ReportDocument(); //DataSet dsRpt = new DataSet(); DXBMS.Data.DataSet1 objDsReports = new Data.DataSet1(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char, 5), //0 new SqlParameter("@FromDate", SqlDbType.DateTime), //0 new SqlParameter("@ToDate", SqlDbType.DateTime), //0 new SqlParameter("@Status", SqlDbType.VarChar, 10) //0 }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = FromDate.ToString("yyyy-MM-dd"); param[2].Value = ToDate.ToString("yyyy-MM-dd"); param[2].Value = rbStatus.SelectedItem.Value.ToString(); //if (myFunc.ExecuteSPDMIS("sp2W_Spare_InvoiceDetail", param, ref rder)) //if(myFunc.ExecuteSP("sp2W_Spare_InvoiceDetail",param,ref rder)) //{ // objDsReports.sp2W_Spare_InvoiceDetail.Load(rder); //} DataTable dt = new DataTable(); string sql = "exec sp_JobCardDetailReport '" + Session["DealerCode"].ToString() + "','" + FromDate.ToString("yyyy-MM-dd") + "','" + ToDate.ToString("yyyy-MM-dd") + "','" + rbStatus.SelectedItem.Value.ToString() + "'"; dt = myFunc.GetData(sql); RD.PrintOptions.PaperSize = PaperSize.PaperA4; //RD.Load(Server.MapPath("../../SpareReports/rptJobCardDateWise.rpt")); RD.Load(Server.MapPath("../rptJobCardDateWise.rpt")); //RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Phone1", "Dealer") + "'"; //RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Email", "Dealer") + "'"; //RD.DataDefinition.FormulaFields["DealerName"].Text = "'" + myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "DealerDesc", "Dealer") + "'"; //RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Address1", "Dealer") + "" + // myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Address2", "Dealer") + "" + // myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Address3", "Dealer") + " (" + // myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Phone1", "Dealer") + ") '"; RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserID"].ToString() + "'"; RD.DataDefinition.FormulaFields["FromCode"].Text = "'" + FDate + "'"; RD.DataDefinition.FormulaFields["ToCode"].Text = "'" + TDate + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Jobcard Detail Report" + "\""; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //RD.Database.Tables[0].SetDataSource(objDsReports); RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.Database.Tables[0].SetDataSource(dt); // convert and show string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "JobCardDetail" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; string File = FilePath + FileName; RD.ExportToDisk(ExportFormatType.PortableDocFormat, File); string URL; URL = "../../../../Download/OpenPdf.aspx?FileName=" + FileName; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
public Tuple <Decimal, String> CalculatePartYearlyAL() { Decimal FinalValue = 0.0M; String Log = ""; try { Log += "Beginning of Partial Holiday Year Annual Leave calculation" + Environment.NewLine; decimal ALPerAnnumUndrounded = 240 * (HoursPerWeek / 40); decimal ALPerAnnumRounded = Math.Round(ALPerAnnumUndrounded, 2); Log += HoursPerWeek + " hour contract = Entitlement to " + ALPerAnnumRounded + " hours per annum" + Environment.NewLine; Log += "Person starts on " + StartDate.ToShortDateString() + Environment.NewLine; if (FromDate != null && ToDate != null) { //Counting Full Months int MonthsAway = 0; //Find Annual Leave per month decimal ALPerMonth = ALPerAnnumRounded / 12; if (ToDate.Year > FromDate.Year) { //Months left in the FromDate Year int MonthsLeftInStartDateYear = 12 - StartDate.Month; //Add the months left in the ToDate year int MonthsLeft = MonthsLeftInStartDateYear + ToDate.Month; MonthsAway = MonthsLeft; Log += "Count full months = " + FromDate.ToString("MMMM") + " to " + ToDate.ToString("MMMM") + " = " + MonthsAway + " full months" + Environment.NewLine; } else if (ToDate.Year == FromDate.Year) { MonthsAway = ToDate.Month - StartDate.Month; } Log += "AL Per Month is " + ALPerAnnumRounded + " / 12 = " + ALPerMonth + Environment.NewLine; //Find the amount of Annual Leave acquired for the full months decimal FullMonthsAnnualLeave = MonthsAway * ALPerMonth; Log += "Therefore the full months annual leave is (" + MonthsAway + " * " + ALPerMonth + " = " + FullMonthsAnnualLeave + Environment.NewLine; //Find how many days they will be working in that month decimal DaysWorkingWithinMonth = DateTime.DaysInMonth(FromDate.Year, FromDate.Month) - FromDate.Day; Log += "Person started on the " + StartDate.ToString("DDDD") + " of " + StartDate.ToString("MMMM" + Environment.NewLine); Log += "There is " + DateTime.DaysInMonth(FromDate.Year, FromDate.Month) + " days in that month" + Environment.NewLine; DaysWorkingWithinMonth++; Log += "Meaning they worked " + DaysWorkingWithinMonth + " days in " + FromDate.ToString("MMMM") + Environment.NewLine; //Divide their DaysWorkingWithinMonth by the total of days within that month decimal DaysInStartMonth = DateTime.DaysInMonth(FromDate.Year, FromDate.Month); decimal EntitleToOfMonth = DaysWorkingWithinMonth / DaysInStartMonth; //Round the number decimal EntitleRound = Math.Round(EntitleToOfMonth, 1); Log += "This means they are entitle to (" + DaysWorkingWithinMonth + " / " + DaysInStartMonth + " = " + EntitleRound + " of the month" + Environment.NewLine; //Multiply the Annual Leave per Month and the Entitle Round to get the Annual Leave for partial month decimal AnnualLeaveForPartialMonthUnRound = EntitleRound * ALPerMonth; //Round out the Partial Month value so it's whole hours decimal AnnualLeaveForPartialMonth = Math.Round(AnnualLeaveForPartialMonthUnRound, 0); Log += EntitleRound + " of " + ALPerMonth + " per month = entitled to " + AnnualLeaveForPartialMonth + " in " + FromDate.ToString("MMMM") + " " + FromDate.ToString("YYYY") + Environment.NewLine; //Adding the partial month on to Annual Leave for the months left decimal FullAnnualLeave = AnnualLeaveForPartialMonth + FullMonthsAnnualLeave; Log += "Add the Partial Month value of " + AnnualLeaveForPartialMonth + " to the Full Months Annual Leave value of " + FullMonthsAnnualLeave + " = " + FullAnnualLeave + " hours" + Environment.NewLine; FinalValue = FullAnnualLeave; } } catch (Exception ex) { ExceptionHandler.ThrowException(ex); Log += "An error occurred during calculation. Error shown to user as: " + ex.Message + Environment.NewLine; } Log += "End of Partial Holiday Year Annual Leave calculation" + Environment.NewLine; return(Tuple.Create(FinalValue, Log)); }
public override ReportParameter[] GetReportParameters(string UserName) { ReportParameter[] param = new ReportParameter[4]; param[0] = new ReportParameter("ReportHeader", "J.A.R.V.I.S. - Job Report"); param[1] = new ReportParameter("DateRange", "Between " + FromDate.ToString("dd-MMM-yyyy") + " and " + ToDate.ToString("dd-MMM-yyyy")); param[2] = new ReportParameter("JobStatus", "Completed Jobs"); string searchCriteria = "For " + UserName; if (CustomerName.Length > 0) { searchCriteria += ", " + CustomerName; } if (PrismNo.Length > 0) { searchCriteria += ", " + PrismNo; } param[3] = new ReportParameter("SearchFilter", searchCriteria); return(param); }
private async void Generate() { string uriData = $"%7B%22name%22%3A%22{Name}%22%2C%22portion%22%3A%22{Portion}%22%2C%22company%22%3A%22{Company}%22%2C%22seller%22%3A%22{Seller}%22%2C%22from_date%22%3A%22{FromDate.ToString()}%22%2C%22to_date%22%3A%22{ToDate.ToString()}%22%7D"; Dictionary <string, string> args = new Dictionary <string, string>(); args.Add("access_token", _session.AccessToken); args.Add("data", uriData); GenerateResponse res = await _session.GetJson <GenerateResponse>("generate", args); if (res.Hash != string.Empty) { IronBarCode.BarcodeWriter.CreateBarcode(res.Hash, IronBarCode.BarcodeWriterEncoding.QRCode).SaveAsPng(res.Hash + ".png"); MessageBox.Show("Операция выполнена успешно", "PharmaChain", MessageBoxButton.OK); } else { MessageBox.Show("Ошибка токена", "PharmChain", MessageBoxButton.OK); } }
private void ExecuteExport(object obj) { GlobalClass.ReportName = "Transaction Activity Log"; GlobalClass.ReportParams = string.Format("From Date : {0} To {1}", FromDate.ToString("MM/dd/yyyy"), ToDate.ToString("MM/dd/yyyy")); wExportFormat ef = new wExportFormat(rv.Report); ef.ShowDialog(); }
protected void btnShowReport_Click(object sender, EventArgs e) { if (!sec.UserRight("2564", "006")) { Response.Redirect("~/Test.aspx"); } if (dtFrom.Text == "" || dtTo.Text == "") { lblMSG.Text = "Please select dates"; return; } SqlDataReader rder; ReportDocument RD = new ReportDocument(); DateTime FromDate; DateTime ToDate; string FDate = myFunc.SaveDate(dtFrom.Text).ToString(); string TDate = myFunc.SaveDate(dtTo.Text).ToString(); FromDate = Convert.ToDateTime(FDate); ToDate = Convert.ToDateTime(TDate); //ReportDocument RD = new ReportDocument(); //DataSet dsRpt = new DataSet(); DXBMS.Data.DataSet1 objDsReports = new Data.DataSet1(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char, 5), //0 new SqlParameter("@FromDate", SqlDbType.DateTime), //0 new SqlParameter("@ToDate", SqlDbType.DateTime), //0 new SqlParameter("@Status", SqlDbType.VarChar, 10), //0 new SqlParameter("@EmpCode", SqlDbType.Char, 06) //0 }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = FromDate.ToString("yyyy-MM-dd"); param[2].Value = ToDate.ToString("yyyy-MM-dd"); param[3].Value = rbStatus.SelectedItem.Value.ToString(); param[4].Value = ddlAdvisorCode.SelectedValue; DataTable dt = new DataTable(); string sql = "exec sp_JobCardDetailReport '" + Session["DealerCode"].ToString() + "','" + FromDate.ToString("yyyy-MM-dd") + "','" + ToDate.ToString("yyyy-MM-dd") + "','" + rbStatus.SelectedItem.Value.ToString() + "','" + ddlAdvisorCode.SelectedValue + "'"; dt = myFunc.GetData(sql); RD.Load(Server.MapPath("../rptJobCardDateWise.rpt")); RD.OpenSubreport(Server.MapPath("../JobCardSummary.rpt")); RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerFax"].Text = "'" + Session["DealerFax"].ToString() + "'"; RD.DataDefinition.FormulaFields["NTN"].Text = "'N.T.N # " + Session["DealerNTN"].ToString() + "'"; RD.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No. " + Session["DealerSaleTaxNo"].ToString() + " '"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserID"].ToString() + "'"; RD.DataDefinition.FormulaFields["FromCode"].Text = "'" + FDate + "'"; RD.DataDefinition.FormulaFields["ToCode"].Text = "'" + TDate + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Jobcard Detail Report" + "\""; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //RD.Database.Tables[0].SetDataSource(objDsReports); //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; RD.SetDataSource(dt); string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; PdfDocument outputDocument = new PdfDocument(); Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } stream.Dispose(); stream.Close(); string URL = "../../../../Download/PrintReport.aspx"; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); //string FilePath = Server.MapPath("~") + "\\Download\\"; //string FileName = "JobCardDetail" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; //string File = FilePath + FileName; //Session["RD"] = RD; //string URL = "../../../../Download/rptViewerService.aspx?ReportID="+ FileName; //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1500,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
/// <summary> /// Prints formatted reservation information /// </summary> /// <returns>The formatted string of reservation information</returns> public override string ToString() { return(Name.ToString().PadRight(6) + FromDate.ToString().PadRight(30) + ToDate.ToString().PadRight(30)); }
public override string ToString() { if (Date == DateTime.MinValue || Multiplier < 0) { return(string.Format("{0} | {1}", Name, Price)); } return(string.Format("{0} | {1},- | {2} | {3} | {4}", Name, Price, Date.ToString(), ToDate.ToString(), Multiplier)); }
protected void RepeaterTransfer_ItemCommand(object source, RepeaterCommandEventArgs e) { try { //int index = e.Item; DateTime FromDate; DateTime ToDate; int Distributor = 0; int ClientTypeID = Convert.ToInt32(Session["ClientTypeID"]); if (e.CommandName == "ChangeStatus") { long PaymentID = Convert.ToInt32(e.CommandArgument); Label lblChargedAmount = (Label)RepeaterTransfer.FindControl("lblChargedAmount"); int retval = 0; //ssc.ChangeStatusForTopUp(Convert.ToInt32(Session["DistributorID"]), Convert.ToInt32(Session["LoginId"]), Convert.ToInt32(Session["ClientTypeID"]), PaymentID); if (retval > 0) { ShowPopUpMsg("Change Status Successfully."); if (ddlDistributor.SelectedValue == "0") { Distributor = 1; } else { Distributor = Convert.ToInt32(ddlDistributor.SelectedValue); } if (txtFromDate.Text.Trim() != "" && txtToDate.Text.Trim() != "") { FromDate = Convert.ToDateTime(txtFromDate.Text.Trim()); ToDate = Convert.ToDateTime(txtToDate.Text.Trim()); txtFromDate.Text = Convert.ToString(FromDate.ToString("MM-dd-yyyy")); txtToDate.Text = Convert.ToString(ToDate.ToString("MM-dd-yyyy")); } else { DateTime today = DateTime.Today; int numberOfDaysInMonth = DateTime.DaysInMonth(today.Year, today.Month); FromDate = new DateTime(today.Year, today.Month, 1); ToDate = new DateTime(today.Year, today.Month, numberOfDaysInMonth); txtFromDate.Text = Convert.ToString(FromDate.ToString("MM-dd-yyyy")); txtToDate.Text = Convert.ToString(ToDate.ToString("MM-dd-yyyy")); } DataSet ds = ssc.GetTopupPaymentDetailsService(Distributor, Convert.ToInt32(Session["LoginId"]), ClientTypeID, txtFromDate.Text.Trim(), txtToDate.Text.Trim()); if (ds != null) { RepeaterTransfer.DataSource = ds.Tables[0]; RepeaterTransfer.DataBind(); //for (int i = 0; i < RepeaterTransfer.Items.Count; i++) //{ // Label lblTransactionStatus = (Label)RepeaterTransfer.Items[i].FindControl("lblTransactionStatus"); // LinkButton lnkChangeStatus = (LinkButton)RepeaterTransfer.Items[i].FindControl("lnkChangeStatus"); // if (lblTransactionStatus.Text == "Pending") // { // lnkChangeStatus.Visible = true; // } // else // { // lnkChangeStatus.Visible = false; // } //} } } else { ShowPopUpMsg("Error! Please Check."); } } } catch (Exception ex) { } }
protected void btnGet_Click(object sender, EventArgs e) { DateTime FromDate; DateTime ToDate; int DistributorID = Convert.ToInt32(Session["DistributorID"]); int ClientTypeID = Convert.ToInt32(Session["ClientTypeID"]); int LoginID = Convert.ToInt32(Session["LoginId"]); //if (txtFromDate.Text.Trim() == "" && txtToDate.Text.Trim() == "") //{ // FromDate = Convert.ToDateTime("1900-01-01"); // ToDate = DateTime.Now; // DataSet ds = ssc.GetTopupPaymentDetailsService(Convert.ToInt32(ddlDistributor.SelectedValue), LoginID,0, FromDate, ToDate); // if (ds != null) // { // RepeaterTransfer.DataSource = ds.Tables[0]; // RepeaterTransfer.DataBind(); // } //} //else if (txtFromDate.Text.Trim() != "" && txtToDate.Text.Trim() == "") //{ // FromDate = Convert.ToDateTime("1900-01-01"); // ToDate = DateTime.Now; // DataSet ds = ssc.GetTopupPaymentDetailsService(Convert.ToInt32(ddlDistributor.SelectedValue), LoginID, 0, FromDate, ToDate); // if (ds != null) // { // RepeaterTransfer.DataSource = ds.Tables[0]; // RepeaterTransfer.DataBind(); // } //} if (txtFromDate.Text.Trim() != "" && txtToDate.Text.Trim() != "") { FromDate = Convert.ToDateTime(txtFromDate.Text.Trim()); ToDate = Convert.ToDateTime(txtToDate.Text.Trim()); txtFromDate.Text = Convert.ToString(FromDate.ToString("MM-dd-yyyy")); txtToDate.Text = Convert.ToString(ToDate.ToString("MM-dd-yyyy")); DataSet ds = new DataSet(); if (ddlDistributor.SelectedIndex == 0) { ds = ssc.GetTopupPaymentDetailsService(Convert.ToInt32(DistributorID), LoginID, ClientTypeID, txtFromDate.Text.Trim(), txtToDate.Text.Trim()); } else { ds = ssc.GetTopupPaymentDetailsService(Convert.ToInt32(ddlDistributor.SelectedValue), LoginID, ClientTypeID, txtFromDate.Text.Trim(), txtToDate.Text.Trim()); } //if (ds != null) //{ ViewState["tblexcel"] = ds.Tables[0]; RepeaterTransfer.DataSource = ds.Tables[0]; RepeaterTransfer.DataBind(); //for (int i = 0; i < RepeaterTransfer.Items.Count; i++) //{ // Label lblTransactionStatus = (Label)RepeaterTransfer.Items[i].FindControl("lblTransactionStatus"); // LinkButton lnkChangeStatus = (LinkButton)RepeaterTransfer.Items[i].FindControl("lnkChangeStatus"); // if (lblTransactionStatus.Text == "Pending") // { // lnkChangeStatus.Visible = true; // } // else // { // lnkChangeStatus.Visible = false; // } //} //} } }
private void ExecuteLoad(object obj) { try { rv = new ReportViewer(); string Param = string.Format("{{\"FLG\" : \"{0}\", \"SDATE\" : \"{1}\", \"EDATE\" : \"{2}\"", FLAG, FromDate.ToString("MM/dd/yyyy"), ToDate.ToString("MM/dd/yyyy")); if (!string.IsNullOrEmpty(TrnUser)) { Param += string.Format(", \"USERID\" : \"{0}\"", TrnUser); } if (!string.IsNullOrEmpty(ComputerName)) { Param += string.Format(", \"HOSTNM\" : \"{0}\"", ComputerName); } if (!string.IsNullOrEmpty(EntryForm)) { Param += string.Format(", \"FORMNM\" : \"{0}\"", EntryForm); } if (!string.IsNullOrEmpty(TrnAction)) { Param += string.Format(", \"ACTIONNM\" : \"{0}\"", TrnAction); } Param += "}"; // LoadColumns(); var data = GetDataFromProcedure("sp_UserWLogDetail", Param); if (data != null && data.Count() == 0) { MessageBox.Show("NoData"); } else { ReportSource = new ObservableCollection <dynamic>(data); } GlobalClass.SetUserActivityLog("Transaction Activities Log", "View", string.Empty, string.Empty, string.Empty); rv.DataContext = this; rv.Show(); //using (SqlConnection Conn = new SqlConnection(GlobalClass.DataConnectionString)) //using (DataAccess da = new DataAccess()) //{ // Conn.Open(); // //CommandDefinition Cmd = new CommandDefinition(ProcName,this,null,null,System.Data.CommandType.StoredProcedure); // //Cmd.CommandText = ProcName; // //Cmd.CommandType = System.Data.CommandType.StoredProcedure; // DynamicParameters d = new DynamicParameters(); // foreach (ReportDetail rd in Parameters) // { // if (string.IsNullOrEmpty(rd.PropName)) // { // if (!string.IsNullOrEmpty(rd.Value)) // d.Add(rd.ParamName, rd.Value); // continue; // } // if (CheckDefaultParameter(rd)) // continue; // d.Add(rd.ParamName, GetValue(rd)); // //Cmd.Parameters.AddWithValue(rd.ParamName, GetValue(rd)); // } // //ReportSource = new VirtualizingCollectionView(Conn.Query<TrnMain>(ProcName, d, commandType: System.Data.CommandType.StoredProcedure)); // ReportSource = new ObservableCollection<dynamic>(Conn.Query<dynamic>(ProcName, d, commandType: System.Data.CommandType.StoredProcedure, commandTimeout: 600)); // LoadColumns(rv, Conn); // foreach (dynamic cm in Conn.Query("SELECT MENUNAME, COMMANDNAME FROM REPORTCONTEXTMENU WHERE REPORTNAME ='" + ReportName + "'")) // { // MenuItem mi = new MenuItem(); // mi.Header = cm.MENUNAME; // Binding b = new Binding(cm.COMMANDNAME); // mi.SetBinding(MenuItem.CommandProperty, b); // Binding CommandParameterBinding = new Binding("Data"); // CommandParameterBinding.Source = rv.FindResource("proxy"); // // mi.CommandParameter = SelectedItem; // //CommandParameterBinding.Path = new System.Windows.PropertyPath("SelectedItem", null); // //CommandParameterBinding.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(SfDataGrid), 1); // mi.SetBinding(MenuItem.CommandParameterProperty, CommandParameterBinding); // rvContextMenu.Add(mi); // } //} //rv.DataContext = this; //rv.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }