private void GridDataBind() { try { TrustPayItemBl objTrustPayItemBl = new TrustPayItemBl(); ApplicationResult objResult = new ApplicationResult(); objResult = objTrustPayItemBl.PayItemTemplate_SelectAll_TemplateID(Convert.ToInt32(ddlSelectTemplateName.SelectedValue)); if (objResult != null) { gvPayTemplate.DataSource = objResult.resultDT; gvPayTemplate.DataBind(); if (objResult.resultDT.Rows.Count > 0) { gvPayTemplate.Visible = true; } else { gvPayTemplate.Visible = false; } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void ddlTemplate_SelectedIndexChanged(object sender, EventArgs e) { try { TrustPayItemBl objTrustPayItemBl = new TrustPayItemBl(); ApplicationResult objResult = new ApplicationResult(); gvSelectedPayItem.Visible = false; gvPayItem.Visible = true; objResult = objTrustPayItemBl.PayItemTemplate_SelectAll_TemplateID(Convert.ToInt32(ddlTemplate.SelectedValue)); if (objResult != null) { gvPayItem.DataSource = objResult.resultDT; gvPayItem.DataBind(); if (objResult.resultDT.Rows.Count > 0) { PanelVisibility(true, false, true, false); } else { PanelVisibility(false, false, true, false); } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void btnSave_Click(object sender, EventArgs e) { try { TrustPayItemBo objTrustPayItemBO = new TrustPayItemBo(); TrustPayItemBl objTrustPayItemBl = new TrustPayItemBl(); ApplicationResult objTrustTemplateResult = new ApplicationResult(); objTrustTemplateResult = objTrustPayItemBl.TrustPayItem_SelectAll_AscOrder(Convert.ToInt32(Session[ApplicationSession.TRUSTID])); #region RollBack Transaction Starts DatabaseTransaction.OpenConnectionTransation(); ApplicationResult objResultsDelete = new ApplicationResult(); if (objTrustTemplateResult.resultDT.Rows.Count > 0) { for (int i = 0; i < objTrustTemplateResult.resultDT.Rows.Count; i++) { objResultsDelete = objTrustPayItemBl.TrustPayItem_Delete(Convert.ToInt32(objTrustTemplateResult.resultDT.Rows[i][TrustPayItemBo.TRUSTPAYITEM_TRUSTPAYITEMID].ToString()), Convert.ToInt32(Session[ApplicationSession.USERID]), DateTime.UtcNow.AddHours(5.5).ToString()); } } foreach (GridViewRow row in gvPayItem.Rows) { if (((CheckBox)row.FindControl("CheckBoxPayItem")).Checked) { objTrustPayItemBO.PayItemID = Convert.ToInt32(row.Cells[0].Text); objTrustPayItemBO.LastModifiedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objTrustPayItemBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); ApplicationResult objResultsInsert = new ApplicationResult(); objTrustPayItemBO.TrustMID = Convert.ToInt32(Session[ApplicationSession.TRUSTID]); objTrustPayItemBO.CreatedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objTrustPayItemBO.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); objResultsInsert = objTrustPayItemBl.TrustPayItem_Insert(objTrustPayItemBO); if (objResultsInsert != null) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Fees Amount Successfully Saved.');</script>"); } } } DatabaseTransaction.CommitTransation(); #endregion BindGridView(); // Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "BindClass();", true); // divLoading.Visible = false; // Response.Redirect("Class_Template.aspx"); } catch (Exception ex) { DatabaseTransaction.RollbackTransation(); logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
public void BindGridView() { try { ApplicationResult objResult = new ApplicationResult(); TrustTemplateBl objTrustTemplateBL = new TrustTemplateBl(); objResult = objTrustTemplateBL.TrustTemplate_SelectAll_PayItemWithAsc(Convert.ToInt32(Session[ApplicationSession.TRUSTID])); if (objResult != null) { gvPayItem.DataSource = objResult.resultDT; gvPayItem.DataBind(); if (objResult.resultDT.Rows.Count > 0) { gvPayItem.Visible = true; ApplicationResult objTrustTemplateResult = new ApplicationResult(); TrustPayItemBl objTrustPayItemBl = new TrustPayItemBl(); objTrustTemplateResult = objTrustPayItemBl.TrustPayItem_SelectAll_AscOrder(Convert.ToInt32(Session[ApplicationSession.TRUSTID])); foreach (GridViewRow row in gvPayItem.Rows) { if (objTrustTemplateResult.resultDT.Rows.Count > 0) { int i; for (i = 0; i < objTrustTemplateResult.resultDT.Rows.Count; i++) { if (Convert.ToInt32(row.Cells[0].Text) == Convert.ToInt32(objTrustTemplateResult.resultDT.Rows[i][TrustPayItemBo.TRUSTPAYITEM_PAYITEMID].ToString())) { ((CheckBox)row.FindControl("CheckBoxPayItem")).Checked = true; btnSave.Enabled = true; } } } } } } btnSave.Visible = true; //btnCancel.Visible = true; } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void gvSelectedPayItem_RowCommand(object sender, GridViewCommandEventArgs e) { try { UserPayItemTemplateTBl objUserPayItemtBL = new UserPayItemTemplateTBl(); UserPayItemTemplateTBo objUserPayItemBO = new UserPayItemTemplateTBo(); TrustPayItemBl objTrustPayItemBl = new TrustPayItemBl(); ApplicationResult objResultsPayItem = new ApplicationResult(); string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' }); ViewState["UserTemplateID"] = commandArgs[0]; ViewState["PayItemMID"] = commandArgs[1]; ViewState["UserPayItemTemplateID"] = commandArgs[2]; if (e.CommandName.ToString() == "Edit1") { PanelVisibility(false, true, true, true); txtPayItemName.Enabled = false; ddlPayItemType.Enabled = false; ddlDependsOn.Enabled = false; btnApplyTemplate.Visible = false; ddlTemplate.Enabled = false; txtAnnual.Enabled = false; txtMonthly.Enabled = false; txtGross.Enabled = false; String[] Depends; // PayItemType = gdSelectedPayItem.SelectedRow.Cells[3].Text; TrustPayItemTemplateTBl objTrustPayItemTemplateBl = new TrustPayItemTemplateTBl(); ApplicationResult objResults = new ApplicationResult(); Controls objControls = new Controls(); objResults = objTrustPayItemTemplateBl.TrustPayItemTemplate_Select_PayItemWise(Convert.ToInt32(ddlTemplate.SelectedValue)); objControls.BindDropDown_ListBox(objResults.resultDT, ddlDependsOn, "Name", "PayItemMID"); ddlDependsOn.Items.Insert(0, new ListItem("-Select-", "-1")); objResultsPayItem = objTrustPayItemBl.PayItemTemplate_SelectAll_BothID(Convert.ToInt32(ViewState["UserTemplateID"].ToString()), Convert.ToInt32(ViewState["PayItemMID"].ToString())); if (objResultsPayItem != null) { if (objResultsPayItem.resultDT.Rows.Count > 0) { txtAmount.Text = Convert.ToString(Math.Round(Convert.ToDouble(objControls.ConvertToCurrancy(objResultsPayItem.resultDT.Rows[0]["Amount"].ToString())), 2)); txtPercentage.Text = objResultsPayItem.resultDT.Rows[0]["Percentage"].ToString(); Depends = objResultsPayItem.resultDT.Rows[0]["DependsOn"].ToString().Split(','); int i = 0; int len = Depends.Length; for (i = 0; i < len; i++) { if (i >= len) { break; } else { if (Depends[i] != "NULL" && Depends[i] != " " && Depends[i] != "" && Depends[i] != "0") { //cbDependsOn.SelectedValue = str[i]; // cbDependsOn.Items.Add(Depends[i]); ddlDependsOn.SelectedValue = Depends[i]; } else { ddlDependsOn.SelectedValue = null; } } } txtPayItemName.Text = objResultsPayItem.resultDT.Rows[0]["Name"].ToString(); // ddlPayItemType.SelectedValue = gvSelectedPayItem.SelectedRow.Cells[3].Text; if (objResultsPayItem.resultDT.Rows[0]["Type"].ToString() == "Dependent") { ddlPayItemType.SelectedValue = "1"; txtPercentage.Enabled = true; txtPercentage.BackColor = System.Drawing.Color.White; txtAmount.BackColor = System.Drawing.Color.Gainsboro; } else if (objResultsPayItem.resultDT.Rows[0]["Type"].ToString() == "Independent") { ddlPayItemType.SelectedValue = "0"; txtAmount.Enabled = true; txtAmount.BackColor = System.Drawing.Color.White; txtPercentage.BackColor = System.Drawing.Color.Gainsboro; txtPercentage.Enabled = false; } else if (objResultsPayItem.resultDT.Rows[0]["Type"].ToString() == "Depends On Gross") { ddlPayItemType.SelectedValue = "2"; txtPercentage.Enabled = true; txtPercentage.BackColor = System.Drawing.Color.White; txtAmount.BackColor = System.Drawing.Color.Gainsboro; txtAmount.Enabled = false; } } } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }