private void BindReport() { Entity.Accounts.MeetingRentExpense EntMeet = new Entity.Accounts.MeetingRentExpense(); EntMeet.LedgerId = Convert.ToInt32(ddlLedgerS.SelectedValue); EntMeet.DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue); string FromDate1 = (txtFromDate.Text.ToString()); string ToDate1 = (txtToDate.Text.ToString()); if (FromDate1 != "" && ToDate1 != "") { EntMeet.FromDate = Convert.ToDateTime(FromDate1); // Convert.ToDateTime(txtFromDate.Text.Split('/')[2] + "-" + txtFromDate.Text.Split('/')[1] + "-" + txtFromDate.Text.Split('/')[0]); EntMeet.ToDate = Convert.ToDateTime(ToDate1); // Convert.ToDateTime(txtToDate.Text.Split('/')[2] + "-" + txtToDate.Text.Split('/')[1] + "-" + txtToDate.Text.Split('/')[0]); } else { EntMeet.FromDate = DateTime.MinValue; EntMeet.ToDate = DateTime.MinValue; } BusinessLayer.Accounts.MeetingRentExpense objmeeting = new MeetingRentExpense(); DataTable DT = objmeeting.GetAll(EntMeet); if (DT != null && DT.Rows.Count > 0) { grdReport.DataSource = DT; grdReport.DataBind(); btnDownload.Visible = true; } }
protected void gvCBVView_RowDeleting(object sender, GridViewDeleteEventArgs e) { BusinessLayer.Accounts.StudentFeesCollection objSfc = new BusinessLayer.Accounts.StudentFeesCollection(); int headerId = int.Parse(gvCBVView.DataKeys[e.RowIndex].Value.ToString()); objSfc.DeleteCVB(headerId); //**************** //** MeetingrentExpense Delete on respective CBVHeaderID BusinessLayer.Accounts.MeetingRentExpense objmeet = new MeetingRentExpense(); objmeet.Delete(headerId); PopulateHeaderGrid(ViewState["sortColumn"].ToString(), ViewState["sortDirection"].ToString()); }
protected void PopulateDistrictGrid(int CBVHeaderID) { BusinessLayer.Accounts.MeetingRentExpense objmeet = new MeetingRentExpense(); DataTable DT = objmeet.GetAllById(CBVHeaderID); foreach (GridViewRow row in grdvwDistrict.Rows) { if (row.RowType == DataControlRowType.DataRow) { int DistrictId = int.Parse(grdvwDistrict.DataKeys[row.RowIndex].Value.ToString()); TextBox txtAmount = row.FindControl("txtAmount") as TextBox; bool exists = DT.AsEnumerable().Where(c => c.Field <int>("DistrictId").Equals(DistrictId)).Count() > 0; if (exists) { DataRow a = DT.AsEnumerable().Where(r => ((int)r["DistrictId"]) == DistrictId).Single(); string b = a.Field <decimal>("Amount").ToString(); txtAmount.Text = b; } //var b = DT.AsEnumerable().Where(p => p.Field<int>("DistrictId") == DistrictId).CopyToDataTable(); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (Session["Details"] == null || ((DataSet)Session["Details"]).Tables[0].Rows.Count == 0) { Response.Redirect("../Login.aspx"); } else { if (Validate()) { string rtMsg = ""; string strSPName = ""; string strValues = ""; int intID; strValues = DateTime.Now.ToString("dd MMM yyyy"); strValues += chr.ToString() + ""; DataSet ds_fn = gf.ExecuteSelectSP("spSelect_GetFnYear", strValues); strValues = ""; //if (ds_fn.Tables[0].Rows[0]["FinYearID"].ToString() == Session["FinYrID"].ToString().Trim()) //{ intID = Convert.ToInt32(hdnCBVHeaderID.Value); if (intID == 0) { //btnPrint.Enabled = false; strSPName = "spInsert_TrnCashBankVoucher"; } else { strValues = intID.ToString(); strSPName = "spUpdate_TrnCashBankVoucher"; } ds = (DataSet)Session["Details"]; if (strValues == "") { strValues = Session["CompanyId"].ToString(); } else { strValues += chr.ToString() + Session["CompanyId"].ToString(); } strValues += chr.ToString() + Session["FinYrID"].ToString(); strValues += chr.ToString() + Session["BranchID"].ToString(); strValues += chr.ToString() + Session["DataFlow"].ToString(); strValues += chr.ToString() + txtVoucherDate.Text.Trim(); strValues += chr.ToString() + ddlType.SelectedItem.ToString(); //strValues += chr.ToString() + ((ddlDRCR.SelectedValue == "RECEIVE") ? "PAYMENT" : "RECEIVE"); strValues += chr.ToString() + "CASH"; strValues += chr.ToString() + ddlSourceLedger.SelectedValue.ToString(); strValues += chr.ToString() + ""; strValues += chr.ToString() + ""; strValues += chr.ToString() + ""; strValues += chr.ToString() + txtAccount.Text; //@OnAccountAmount strValues += chr.ToString() + txtAccount.Text; // @TotalAmount strValues += chr.ToString() + txtNarration.Text.Trim(); strValues += chr.ToString() + Session["UserId"].ToString(); strValues += chr.ToString() + PrepareXMLString(); //strValues += chr.ToString() + PrepareDistrictAmountXMLString(); strValues += chr.ToString() + ""; rtMsg = gf.ExecuteAnySPOutput(strSPName, strValues); string strMsg = rtMsg.Substring(0, 4); if (strMsg == "True") { hdnCBVHeaderID.Value = rtMsg.Substring(5, rtMsg.Length - 5); // Meeting Rent Expense Save District Amount BusinessLayer.Accounts.MeetingRentExpense objMeet = new MeetingRentExpense(); Entity.Accounts.MeetingRentExpense EntMeet = new Entity.Accounts.MeetingRentExpense(); EntMeet.CBVHeaderID = Convert.ToInt32(hdnCBVHeaderID.Value); EntMeet.PaymentDate = DateTime.Parse(txtVoucherDate.Text.ToString()); EntMeet.DistrictAmountXML = PrepareDistrictAmountXMLString(); EntMeet.CreatedBy = int.Parse(Session["UserId"].ToString()); int RowAffected = objMeet.SaveDetails(EntMeet); // *** CLOSE *** PopulatePage(Convert.ToInt32(hdnCBVHeaderID.Value)); Message.IsSuccess = true; Message.Text = "Your request has been processed successfully!"; //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "VR", "window.open('sms-receipt.aspx?No=" + txtVchNo.Text + "','','height=600,width=1000')", true); AdjustButtons(true, true, false); PopulateHeaderGrid(ViewState["sortColumn"].ToString(), ViewState["sortDirection"].ToString()); } else { Message.IsSuccess = false; Message.Text = rtMsg; } } //} //else //{ // Message.IsSuccess = false; //Message.Text = "Please select a Date Between " + Session["SesFromDate"].ToString() + " & " + Session["SesToDate"].ToString() + ""; // } } Message.Show = true; }