/// <summary> /// Added By : pradip pawar /// Date : 26-03-2013 /// Desc : Bind MonthlyEntry Details to grid /// </summary> public void BindMonthlyEntryGrid() { objMonthlyEntry = new clsMonthlyEntry(); DataTable dtMonthlyEntry = new DataTable(); try { if (!string.IsNullOrEmpty(txtCustomerNo.Text) && !string.IsNullOrEmpty(ddlmonth.SelectedValue) && !string.IsNullOrEmpty(ddlyear.SelectedValue)) { objMonthlyEntry.CustomerId = Convert.ToInt64(hdnCustomerId.Value); ; objMonthlyEntry.EntryMonth = Convert.ToInt32(ddlmonth.SelectedValue); objMonthlyEntry.EntryYear = Convert.ToInt32(ddlyear.SelectedValue); } else { objMonthlyEntry.CustomerId = 0; objMonthlyEntry.EntryMonth = 0; objMonthlyEntry.EntryYear = 0; } dtMonthlyEntry = objMonthlyEntry.SearcheAllmonthlyEntryWSearchFilters(); if (dtMonthlyEntry.Rows.Count > 0) { gvMonthlyEntry.DataSource = dtMonthlyEntry; } else { gvMonthlyEntry.DataSource = null; } gvMonthlyEntry.PageSize = Convert.ToInt32(ddlMEPager.SelectedValue.ToString()); gvMonthlyEntry.DataBind(); } catch { } finally { objMonthlyEntry = null; dtMonthlyEntry = null; } }
/// <summary> /// Added By : pradip pawar /// Date : 26-03-2013 /// Desc : save record in database /// </summary> protected void gvMonthlyEntry_RowDeleting(object sender, GridViewDeleteEventArgs e) { objMonthlyEntry = new clsMonthlyEntry(); string iEntryType = string.Empty; int iMonthlyEntryTypeID; try { iEntryType = ((Label)gvMonthlyEntry.Rows[e.RowIndex].FindControl("lblEntryType")).Text; switch (iEntryType) { case "LOAN EMI": iMonthlyEntryTypeID = 1; break; case "RD EMI": iMonthlyEntryTypeID = 2; break; default: iMonthlyEntryTypeID = 0; break; } if (!string.IsNullOrEmpty(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()))) { objMonthlyEntry.MonthlyEntryTypeID = iMonthlyEntryTypeID; objMonthlyEntry.EntryAmount = !string.IsNullOrEmpty(Convert.ToDecimal(((Literal)gvMonthlyEntry.Rows[e.RowIndex].FindControl("litEntryAmount")).Text).ToString()) ? Convert.ToDecimal(((Literal)gvMonthlyEntry.Rows[e.RowIndex].FindControl("litEntryAmount")).Text) : 0; objMonthlyEntry.EntryMonth = !string.IsNullOrEmpty(ddlmonth.SelectedValue) ? Convert.ToInt32(ddlmonth.SelectedValue) : 0; objMonthlyEntry.EntryYear = !string.IsNullOrEmpty(ddlyear.SelectedValue) ? Convert.ToInt32(ddlyear.SelectedValue) : 0; objMonthlyEntry.EntryDate = DateTime.Now; objMonthlyEntry.CustomerId = !string.IsNullOrEmpty(((Label)gvMonthlyEntry.Rows[e.RowIndex].FindControl("lblCustomerId")).Text) ? Convert.ToInt64(((Label)gvMonthlyEntry.Rows[e.RowIndex].FindControl("lblCustomerId")).Text) : 0; objMonthlyEntry.LoanId = !string.IsNullOrEmpty(((Label)gvMonthlyEntry.Rows[e.RowIndex].FindControl("lblLoanId")).Text) ? Convert.ToInt32(((Label)gvMonthlyEntry.Rows[e.RowIndex].FindControl("lblLoanId")).Text) : 0; objMonthlyEntry.RecurrenceDepositeId = !string.IsNullOrEmpty(((Label)gvMonthlyEntry.Rows[e.RowIndex].FindControl("lblRecurrenceDepositeId")).Text) ? Convert.ToInt32(((Label)gvMonthlyEntry.Rows[e.RowIndex].FindControl("lblRecurrenceDepositeId")).Text) : 0; objMonthlyEntry.CreatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString())); objMonthlyEntry.CreatedDate = DateTime.Now; objMonthlyEntry.UpdatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString())); objMonthlyEntry.UpdatedDate = DateTime.Now; objMonthlyEntry.IsActive = true; if (objMonthlyEntry.Insert()) { lblMonthlyEntryMessage.CssClass = "SuccessfulMessage"; lblMonthlyEntryMessage.Text = (String)GetGlobalResourceObject("SharedResource", "RecordSavedSuccessfully"); } } else { lblMonthlyEntryMessage.CssClass = "FailureMessage"; lblMonthlyEntryMessage.Text = (String)GetGlobalResourceObject("SharedResource", "LoginSessionExpire"); } BindMonthlyEntryGrid(); } catch { lblMonthlyEntryMessage.CssClass = "FailureMessage"; lblMonthlyEntryMessage.Text = (String)GetGlobalResourceObject("SharedResource", "RecordSavingFailure"); } finally { objMonthlyEntry = null; } }