protected void rgFamilyPayment_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) { try { GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; switch (e.DetailTableView.DataMember) { case "Payment": { DayCareBAL.FamilyPaymentService proxyFamilyPayment = new DayCareBAL.FamilyPaymentService(); List <DayCarePL.FamilyPaymentProperties> lstFamilyPayment = proxyFamilyPayment.GetFamilyWisePayment(new Guid(dataItem.GetDataKeyValue("ChildFamilyId").ToString())); if (lstFamilyPayment != null) { if (lstFamilyPayment != null) { if (lstFamilyPayment.Count > 0) { e.DetailTableView.DataSource = lstFamilyPayment.OrderByDescending(i => i.PostDate); } else { e.DetailTableView.DataSource = new List <DayCarePL.FamilyPaymentProperties>(); } } } break; } } } catch (Exception ex) { } }
protected void Page_Init(object sender, EventArgs e) { if (Session["CurrentSchoolYearId"] == null) { Response.Redirect("~/Login.aspx"); } crdata.Report = rpt; rpt1 = crdata.ReportDocument; DataSet dsReport = new xmlClassWiseStudentAttendTime(); DataSet ds = new DataSet(); string SearchText = ""; rpt.FileName = Server.MapPath("rptDeposit.rpt"); DayCareBAL.FamilyPaymentService proxyPayment = new DayCareBAL.FamilyPaymentService(); if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " l.transactiondate>='" + Request.QueryString["StartDate"].ToString() + "'"; } if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " l.transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + "'"; } else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { SearchText += " l.transactiondate>='" + Request.QueryString["StartDate"].ToString() + "' and l.transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + "'"; } string StartDate = string.Empty; string EndDate = string.Empty; if (Request.QueryString["StartDate"] != "") { StartDate = Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy"); } if (Request.QueryString["EndDate"] != "") { EndDate = Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text14"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); titleText.Text = "Deposit Report From " + StartDate + " To " + EndDate; titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); ds = proxyPayment.LoadPaymentDeposits(SearchText, new Guid(Session["CurrentSchoolYearId"].ToString())); dsReport.Tables["dtDiposit"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtDiposit"]); crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); }
protected void rgFamilyPayment_DeleteCommand(object source, GridCommandEventArgs e) { try { Guid PaymentId = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); DayCareBAL.FamilyPaymentService proxyFamilyPayment = new DayCareBAL.FamilyPaymentService(); if (proxyFamilyPayment.Delete(PaymentId)) { rgFamilyPayment.MasterTableView.DetailTables[0].Rebind(); MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Delete Successfully", "false")); return; } else { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Internal Error,Please try again", "false")); return; } } catch (Exception ex) { } }
protected void btnSave_Click(object sender, EventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); bool result = false; string Amount = ""; try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Debug Submit Record Of SchoolYear", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.FamilyPaymentService proxyFamilyPayment = new DayCareBAL.FamilyPaymentService(); DayCarePL.FamilyPaymentProperties objFamilyPayment = new DayCarePL.FamilyPaymentProperties(); List <DayCarePL.FamilyPaymentProperties> lstFamilyPayment = new List <DayCarePL.FamilyPaymentProperties>(); foreach (GridDataItem e1 in rgFamilyPayment.Items) { TextBox txtAmount = e1.FindControl("txtAmount") as TextBox; RadDatePicker rdpPostDate = e1.FindControl("rdpPostDate") as RadDatePicker; DropDownList ddlPaymentMethod = e1.FindControl("ddlPaymentMethod") as DropDownList; TextBox txtPaymentDetail = e1.FindControl("txtPaymentDetail") as TextBox; if (txtAmount != null && rdpPostDate != null && ddlPaymentMethod != null && txtPaymentDetail != null && rdpPostDate.SelectedDate != null && !string.IsNullOrEmpty(txtAmount.Text) && ddlPaymentMethod.SelectedIndex > 0) { objFamilyPayment = new DayCarePL.FamilyPaymentProperties(); if ((e1.FindControl("rdpPostDate") as RadDatePicker).SelectedDate != null) { objFamilyPayment.PostDate = (e1.FindControl("rdpPostDate") as RadDatePicker).SelectedDate.Value; } else { objFamilyPayment.PostDate = null; } objFamilyPayment.PaymentMethod = (e1.FindControl("ddlPaymentMethod") as DropDownList).SelectedValue; objFamilyPayment.PaymentDetail = (e1.FindControl("txtPaymentDetail") as TextBox).Text; if (!string.IsNullOrEmpty((e1.FindControl("txtAmount") as TextBox).Text)) { Amount = (e1.FindControl("txtAmount") as TextBox).Text; } objFamilyPayment.ChildFamilyId = new Guid((e1.FindControl("lblChildFamilyId") as Label).Text); decimal amountresult = 0; if (!string.IsNullOrEmpty(Amount)) { decimal.TryParse(Amount, out amountresult); if (amountresult == 0) { //objFamilyPayment.Amount = amountresult; //MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; //MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Pease enter valid Amount.", "false")); //return; } else { objFamilyPayment.Amount = amountresult; } } if (Session["CurrentSchoolYearId"] != null) { objFamilyPayment.SchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString()); } //if (e.CommandName != "PerformInsert") //{ if (Session["StaffId"] != null) { objFamilyPayment.CreatedById = new Guid(Session["StaffId"].ToString()); objFamilyPayment.LastModifiedById = new Guid(Session["StaffId"].ToString()); } hdnName.Value = ""; if (amountresult != 0) { lstFamilyPayment.Add(objFamilyPayment); } } } if (lstFamilyPayment.Count > 0) { if (proxyFamilyPayment.Save(lstFamilyPayment)) { btnSave.Enabled = true; btnSave.Attributes.Add("display", "block"); MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully\\nEntries are posted to Ledger", "false")); ViewState["IsPreRenderCall"] = null; rgFamilyPayment.MasterTableView.Rebind(); } } else { btnSave.Enabled = true; btnSave.Attributes.Add("display", "block"); MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please enter valid details at least a family", "false")); } } catch (Exception ex) { btnSave.Enabled = true; btnSave.Attributes.Remove("disabled"); DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } }
public bool SubmitRecord(object sender, GridCommandEventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); bool result = false; string Amount = ""; try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Debug Submit Record Of SchoolYear", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.FamilyPaymentService proxyFamilyPayment = new DayCareBAL.FamilyPaymentService(); DayCarePL.FamilyPaymentProperties objFamilyPayment = new DayCarePL.FamilyPaymentProperties(); foreach (GridDataItem e1 in rgFamilyPayment.Items) { if ((e.Item.FindControl("rdpPostDate") as RadDatePicker).SelectedDate != null) { objFamilyPayment.PostDate = (e1.FindControl("rdpPostDate") as RadDatePicker).SelectedDate.Value; } else { objFamilyPayment.PostDate = null; } objFamilyPayment.PaymentMethod = (e1.FindControl("ddlPaymentMethod") as DropDownList).SelectedValue; objFamilyPayment.PaymentDetail = (e1.FindControl("txtPaymentDetail") as TextBox).Text; if (!string.IsNullOrEmpty((e.Item.FindControl("txtAmount") as TextBox).Text)) { Amount = (e1.FindControl("txtAmount") as TextBox).Text; } objFamilyPayment.ChildFamilyId = new Guid((e1.FindControl("txtChildFamilyId") as Label).Text); if (!string.IsNullOrEmpty(Amount)) { decimal amountresult = 0; decimal.TryParse(Amount, out amountresult); if (amountresult == 0) { objFamilyPayment.Amount = amountresult; MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Pease enter valid Amount.", "false")); return(false); } else { objFamilyPayment.Amount = amountresult; } } if (Session["CurrentSchoolYearId"] != null) { objFamilyPayment.SchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString()); } //if (e.CommandName != "PerformInsert") //{ if (Session["StaffId"] != null) { objFamilyPayment.CreatedById = new Guid(Session["StaffId"].ToString()); objFamilyPayment.LastModifiedById = new Guid(Session["StaffId"].ToString()); } hdnName.Value = ""; } //if (proxyFamilyPayment.Save(objFamilyPayment)) //{ // MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; // MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); // result = true; // ViewState["IsPreRenderCall"] = null; //} //else //{ // result = false; //} } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } return(result); }