protected void BtnExportDetail_Click(object sender, EventArgs e) { if (ViewState["Summary"] != null) { DataTable DtGrd = (DataTable)ViewState["Summary"]; string PURINVNO = string.Empty; if (DtGrd.Rows.Count > 0) { GridView GridExp = new GridView(); GridExp.DataSource = DtGrd; GridExp.DataBind(); Obj_Comm.Export("ListOfRentExpiredProperty.xls", GridExp); } else { Obj_Comm.ShowPopUpMsg("No Data Found To Export..!", this.Page); GrdProjectReport.DataSource = null; GrdProjectReport.DataBind(); } } else { Obj_Comm.ShowPopUpMsg("No Data Found To Export..!", this.Page); SetInitialRow(); } }
public void ReportGrid1() { GrdProjectReport.Visible = true; try { DS = Obj_ProptyRent.FillReportInGrid1(out StrError); //--------------------Inword Grid Bind-------------------------------- if (DS.Tables.Count > 0) { if (DS.Tables[0].Rows.Count > 0) { GrdProjectReport.DataSource = DS.Tables[0]; GrdProjectReport.DataBind(); ViewState["Summary"] = DS.Tables[0]; } } else { GrdProjectReport.DataSource = null; GrdProjectReport.DataBind(); ViewState["Summary"] = null; } } catch (Exception ex) { Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); } }
protected void btnSearch_Click(object sender, EventArgs e) { try { if (ChkDate.Checked) { string FromDate = Convert.ToDateTime(txtFromDate.Text).ToString("yyyy/MM/dd"); string Todate = Convert.ToDateTime(txtToDate.Text).ToString("yyyy/MM/dd"); StrCondition = StrCondition + " And ToDate >= '" + FromDate + "' and ToDate <='" + Todate + "' "; } DS = Obj_ProptyRent.GetPropertyRentExpiredDetails(StrCondition, out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { GrdProjectReport.DataSource = DS.Tables[0]; GrdProjectReport.DataBind(); ViewState["Summary"] = DS.Tables[0]; } else { GrdProjectReport.DataSource = null; GrdProjectReport.DataBind(); SetInitialRow(); //LblRecordCount.Text = "No Record Found!!"; //LblRecordCount.Visible = true; } } catch (Exception ex) { Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); } }
private void SetInitialRow() { try { DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add("#", typeof(int)); dt.Columns.Add("Property", typeof(string)); dt.Columns.Add("PropertyId", typeof(Int32)); dt.Columns.Add("PropertyAddress", typeof(string)); dr = dt.NewRow(); dr["#"] = 0; dr["Property"] = ""; dr["PropertyId"] = 0; dr["PropertyAddress"] = ""; dt.Rows.Add(dr); ViewState["CurrentTable"] = dt; GrdProjectReport.DataSource = dt; GrdProjectReport.DataBind(); } catch (Exception ex) { Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); } }
public void ReportGrid1() { GrdProjectReport.Visible = true; try { DS = Obj_Property.FillReportInGrid1(out StrError); //--------------------Inword Grid Bind-------------------------------- if (DS.Tables.Count > 0) { if (DS.Tables[0].Rows.Count > 0) { GrdProjectReport.DataSource = DS.Tables[0]; GrdProjectReport.DataBind(); ViewState["Summary"] = DS.Tables[0]; if (!FlagPrint) { BtnPrint.Visible = true; BtnExportDetail.Visible = true; } } } else { GrdProjectReport.DataSource = null; GrdProjectReport.DataBind(); ViewState["Summary"] = null; } GrdProjectDtls.Visible = false; } catch (Exception ex) { Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); } }
protected void btnSearch_Click(object sender, EventArgs e) { try { StrCondition = string.Empty; StrConditionFilters = string.Empty; if (ChkDate.Checked) { StrCondition = StrCondition + " And PRD.FromDate Between '" + txtFromDate.Text + "' And '" + txtToDate.Text + "' "; //StrConditionFilters = StrConditionFilters + "FromDate : " + txtFromDate.Text + " ToDate : " + txtToDate.Text + ""; } if (Convert.ToString(txtProperty.Text) != "") { int propId = Convert.ToInt32(hdvSerchProj.Value); StrCondition = StrCondition + " And PR.PropertyId = " + propId; //StrConditionFilters = StrConditionFilters + " Brand : " + ddlBrand.SelectedItem + " "; } if (Convert.ToString(TxtParty.Text) != "") { int PartyId = Convert.ToInt32(hdvSerchParty.Value); StrCondition = StrCondition + " And PR.PartyId = " + PartyId; // StrConditionFilters = StrConditionFilters + " Brand : " + ddlBrand.SelectedItem + " "; } if (Convert.ToString(txtCompanyName.Text) != "") { int CompanyId = Convert.ToInt32(hdvSerchCompany.Value); StrCondition = StrCondition + " And PM.CompanyId = " + CompanyId; // StrConditionFilters = StrConditionFilters + " Brand : " + ddlBrand.SelectedItem + " "; } DS = Obj_ProptyRent.GetPropertyOnRentDetails(StrCondition, out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { GrdProjectReport.DataSource = DS.Tables[0]; GrdProjectReport.DataBind(); ViewState["Summary"] = DS.Tables[0]; } else { GrdProjectReport.DataSource = null; GrdProjectReport.DataBind(); SetInitialRow(); //LblRecordCount.Text = "No Record Found!!"; //LblRecordCount.Visible = true; } } catch (Exception ex) { Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); } }
void select_qry() { try { int flag = 0; string qry = "Select SrNo = ROW_NUMBER() OVER (ORDER BY PM.Property ) , PM.Property +' '+ UnitNo as 'Property Name' ,PMM.PartyName as 'Party Name' ,case when IsGenerated=0 then 'UnPaid' end as Status ,PRD.Amount as Rent,Convert(nvarchar,PRD.FromDate,106) as 'Rental From',Convert(Nvarchar,PRD.ToDate,106) as 'Rental Up To',PMP.FortheMonthYear,PMP.RentalAmount from Property_RentCard PR inner join PropertyRentDetails PRD On PR.PropertyRentCardId=PRD.PropertyRentCardId inner join PropertyMonthMapping PMP on PMP.ProRentDtlsId=PRD.ProRentDtlsId inner join PropertyMaster PM on PR.PropertyId=PM.PropertyId inner join PartyMaster PMM on PMM.PartyId=PR.PartyId Where PR.Isdeleted=0 and PMP.IsGenerated=0 and "; if (chkmonth.Checked == true) { qry += "Convert(datetime,'01/' + FortheMonthYear,103) <='" + txtformonth.Text + "' "; flag++; } if (TxtParty.Text != "") { if (flag != 0) { qry += "and "; } int PartyId = Convert.ToInt32(hdvSerchParty.Value); qry += " (PMM.PartyId='" + PartyId + "')"; flag++; } if (txtProperty.Text != "") { if (flag != 0) { qry += "and "; } int propId = Convert.ToInt32(hdvSerchProj.Value); qry += " (PR.PropertyId='" + propId + "' )"; //qry += " date ='" + txttodate.Text + "'"; flag++; } if (flag == 0) { qry = "Select SrNo = ROW_NUMBER() OVER (ORDER BY PM.Property ) , PM.Property +' '+ UnitNo as 'Property Name' ,PMM.PartyName as 'Party Name' ,case when IsGenerated=0 then 'UnPaid' end as Status ,PRD.Amount as Rent,Convert(nvarchar,PRD.FromDate,106) as 'Rental From',Convert(Nvarchar,PRD.ToDate,106) as 'Rental Up To',PMP.FortheMonthYear,PMP.RemaingAmount from Property_RentCard PR inner join PropertyRentDetails PRD On PR.PropertyRentCardId=PRD.PropertyRentCardId inner join PropertyMonthMapping PMP on PMP.ProRentDtlsId=PRD.ProRentDtlsId inner join PropertyMaster PM on PR.PropertyId=PM.PropertyId inner join PartyMaster PMM on PMM.PartyId=PR.PartyId inner join FlatTypeMaster FTM on FTM.FlatTypeId=PR.FlatTypeId Where PR.Isdeleted=0 and PMP.IsGenerated=0 "; } GrdProjectReport.DataSource = db.Displaygrid(qry); GrdProjectReport.DataBind(); ViewState["Summary"] = db.Displaygrid(qry); } catch (Exception ex) { } }
//public void ReportGrid1() //{ // GrdProjectReport.Visible = true; // try // { // DS = Obj_ProptyRent.FillReportInGrid1(out StrError); // //--------------------Inword Grid Bind-------------------------------- // if (DS.Tables.Count > 0) // { // if (DS.Tables[0].Rows.Count > 0) // { // GrdProjectReport.DataSource = DS.Tables[0]; // GrdProjectReport.DataBind(); // ViewState["Summary"] = DS.Tables[0]; // } // } // else // { // GrdProjectReport.DataSource = null; // GrdProjectReport.DataBind(); // ViewState["Summary"] = null; // } // } // catch (Exception ex) // { // Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); // } //} private void SetInitialRow() { try { DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add("#", typeof(int)); dt.Columns.Add("Property", typeof(string)); dt.Columns.Add("PropertyId", typeof(Int32)); dt.Columns.Add("PartyId", typeof(Int32)); dt.Columns.Add("PartyName", typeof(string)); dt.Columns.Add("CompanyName", typeof(string)); dt.Columns.Add("CompanyId", typeof(Int32)); dt.Columns.Add("RentalAmt", typeof(decimal)); dt.Columns.Add("FromDate", typeof(string)); dt.Columns.Add("ToDate", typeof(string)); dt.Columns.Add("CollectedDate", typeof(string)); dt.Columns.Add("Status", typeof(string)); dr = dt.NewRow(); dr["#"] = 0; dr["Property"] = ""; dr["PropertyId"] = 0; dr["PartyId"] = 0; dr["PartyName"] = ""; dr["CompanyName"] = ""; dr["CompanyId"] = 0; dr["FromDate"] = ""; dr["ToDate"] = ""; dr["CollectedDate"] = ""; dr["RentalAmt"] = 0.00; dr["Status"] = ""; dt.Rows.Add(dr); ViewState["CurrentTable"] = dt; GrdProjectReport.DataSource = dt; GrdProjectReport.DataBind(); } catch (Exception ex) { Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); } }