public List <ServiceGrant> GetGrants(string service) { var grants = from g in cae.ServiceGrants orderby g.GrantDate where g.CommunityService.ServiceName.Equals(service) select new { g.GrantDate, g.GrantAmount, g.ServiceKey, g.GrantApprovalStatus, g.GrantReviewDate, g.GrantAllocation }; List <ServiceGrant> grantList = new List <ServiceGrant>(); foreach (var gr in grants) { ServiceGrant sg = new ServiceGrant(); sg.GrantDate = gr.GrantDate; sg.GrantAmount = gr.GrantAmount; sg.ServiceKey = gr.ServiceKey; sg.GrantApprovalStatus = gr.GrantApprovalStatus; sg.GrantReviewDate = gr.GrantReviewDate; sg.GrantAllocation = gr.GrantAllocation; grantList.Add(sg); } return(grantList); }
public List<ServiceGrant> GetGrants(string service) { var grants = from g in cae.ServiceGrants orderby g.GrantDate where g.CommunityService.ServiceName.Equals(service) select new { g.GrantDate, g.GrantAmount, g.ServiceKey, g.GrantApprovalStatus, g.GrantReviewDate, g.GrantAllocation }; List<ServiceGrant> grantList = new List<ServiceGrant>(); foreach(var gr in grants) { ServiceGrant sg = new ServiceGrant(); sg.GrantDate = gr.GrantDate; sg.GrantAmount = gr.GrantAmount; sg.ServiceKey = gr.ServiceKey; sg.GrantApprovalStatus = gr.GrantApprovalStatus; sg.GrantReviewDate = gr.GrantReviewDate; sg.GrantAllocation = gr.GrantAllocation; grantList.Add(sg); } return grantList; }
protected void btnApplyNow_Click(object sender, EventArgs e) { CommunityAssistEntities ent = new CommunityAssistEntities(); ServiceGrant sgrant = new ServiceGrant(); sgrant.PersonKey = pk; decimal dec = Convert.ToDecimal(txtGrantAmt.Text); sgrant.GrantAmount = dec; sgrant.GrantDate = DateTime.Now; int typekey = Convert.ToInt32(txtGrantTypeKey.Text); sgrant.ServiceKey = typekey; sgrant.GrantNeedExplanation = txtGrantNeedExplain.Text; ent.ServiceGrants.Add(sgrant); //write to database ent.SaveChanges(); //add transaction with rollbackoption and error reporting Response.Redirect("ThankYou.aspx?action=applying&amount=" + txtGrantAmt.Text); }
protected void btnSubmit_Click(object sender, EventArgs e) { CommunityAssistEntities entities = new CommunityAssistEntities(); int pk = (int)Session["Person"]; ServiceGrant g = new ServiceGrant(); g.GrantAmount = Convert.ToDecimal(txtGrantAmount.Text); g.GrantNeedExplanation= txtGrantReason.Text; g.PersonKey = pk; entities.ServiceGrants.Add(g); entities.SaveChanges(); Response.Redirect("TYGrant.aspx"); }
protected void btnGrant_Click(object sender, EventArgs e) { int pk = (int)Session["person"]; CommunityAssistEntities cae = new CommunityAssistEntities(); ServiceGrant g = new ServiceGrant(); g.GrantDate = DateTime.Now; g.PersonKey = pk; g.GrantAmount = decimal.Parse(txtGrantAmount.Text); g.ServiceKey = ddlService.SelectedIndex + 1; cae.ServiceGrants.Add(g); cae.SaveChanges(); Response.Redirect("Choose.aspx"); }
protected void btnGrant_Click(object sender, EventArgs e) { try { CommunityAssistEntities2 ca = new CommunityAssistEntities2(); ServiceGrant g = new ServiceGrant(); DateTime now = DateTime.Now; decimal amt = decimal.Parse(txtgamt.Text); g.GrantAmount = amt; g.GrantDate = now; ca.ServiceGrants.Add(g); ca.SaveChanges(); Response.Redirect("ThankYou.aspx"); } catch (Exception ex) { lblerror.Text = ex.Message; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { CommunityAssistEntities1 cae = new CommunityAssistEntities1(); ServiceGrant sg = new ServiceGrant(); int pk = (int)Session["personKey"]; sg.ServiceKey = int.Parse(ddlGrantType.SelectedValue.ToString()); sg.GrantAmount = Decimal.Parse(txtGrantAmount.Text); sg.GrantDate = DateTime.Now; sg.GrantNeedExplanation = txtExplanation.Text; sg.PersonKey = pk; cae.ServiceGrants.Add(sg); cae.SaveChanges(); Response.Redirect("Confirmation.aspx"); } catch (Exception ex) { lblError.Text = ex.Message; } }