public ActionResult UpdatePetcareDetails(PetCareModel PM) { List <LoginModel> Lmlist = new List <LoginModel>(); con.Open(); string q = "select * from Assignment_Roles where RoleId = " + Convert.ToInt32(Session["rId"]) + ""; SqlDataAdapter da3 = new SqlDataAdapter(q, con); DataTable dt3 = new DataTable(); da3.Fill(dt3); if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { LoginModel lm = new LoginModel(); lm.PageName = dt3.Rows[i]["PageName"].ToString(); lm.PageStatus = dt3.Rows[i]["PageStatus"].ToString(); lm.Action = dt3.Rows[i]["Action"].ToString(); lm.Nav1 = dt3.Rows[i]["Nav1"].ToString(); lm.Nav2 = dt3.Rows[i]["Nav2"].ToString(); Lmlist.Add(lm); } ViewBag.PageName = Lmlist; } con.Close(); con.Open(); string query = "update PetCare set petname='" + PM.petname + "' , petage=" + PM.petage + " , typeofpet='" + PM.typeofpet + "' , amtforpet = " + PM.amtforpet + " , amtfromwhichasset='" + PM.amtfromwhichasset + "' , responsibelpersonforpet='" + PM.responsibelpersonforpet + "' , tid=" + PM.ddltid + " where petid=" + PM.petid + " "; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); con.Close(); ViewBag.Message = "Verified"; return(View("~/Views/UpdatePetCare/UpdatePetCarePageContent.cshtml")); }
// GET: AddPetCare public ActionResult AddPetCareIndex() { ViewBag.collapse = "true"; // check type string typ = ""; con.Open(); string qq1 = "select Type from users where uId = " + Convert.ToInt32(Session["uuid"]) + " "; SqlDataAdapter daa = new SqlDataAdapter(qq1, con); DataTable dtt = new DataTable(); daa.Fill(dtt); con.Close(); if (dtt.Rows.Count > 0) { typ = dtt.Rows[0]["Type"].ToString(); } //end if (typ == "Testator") { // check will status con.Open(); string qry1 = "select Will from users where Will = 1 "; SqlDataAdapter daa1 = new SqlDataAdapter(qry1, con); DataTable dtt1 = new DataTable(); daa1.Fill(dtt1); if (dtt1.Rows.Count > 0) { ViewBag.documentbtn1 = "true"; } con.Close(); //end // check codocil status con.Open(); string qry2 = "select Codocil from users where Codocil = 1 "; SqlDataAdapter daa2 = new SqlDataAdapter(qry2, con); DataTable dtt2 = new DataTable(); daa2.Fill(dtt2); if (dtt2.Rows.Count > 0) { ViewBag.documentbtn2 = "true"; } con.Close(); //end // check Poa status con.Open(); string qry4 = "select POA from users where POA = 1 "; SqlDataAdapter daa4 = new SqlDataAdapter(qry4, con); DataTable dtt4 = new DataTable(); daa4.Fill(dtt4); if (dtt4.Rows.Count > 0) { ViewBag.documentbtn3 = "true"; } con.Close(); //end // check gift deeds status con.Open(); string qry3 = "select Giftdeeds from users where Giftdeeds = 1 "; SqlDataAdapter daa3 = new SqlDataAdapter(qry3, con); DataTable dtt3 = new DataTable(); daa3.Fill(dtt3); if (dtt3.Rows.Count > 0) { ViewBag.documentbtn4 = "true"; } con.Close(); //end } else { ViewBag.showtitle = "true"; ViewBag.documentlink = "true"; } List <LoginModel> Lmlist = new List <LoginModel>(); con.Open(); string q = "select * from Assignment_Roles where RoleId = " + Convert.ToInt32(Session["rId"]) + ""; SqlDataAdapter da3 = new SqlDataAdapter(q, con); DataTable dt3 = new DataTable(); da3.Fill(dt3); if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { LoginModel lm = new LoginModel(); lm.PageName = dt3.Rows[i]["PageName"].ToString(); lm.PageStatus = dt3.Rows[i]["PageStatus"].ToString(); lm.Action = dt3.Rows[i]["Action"].ToString(); lm.Nav1 = dt3.Rows[i]["Nav1"].ToString(); lm.Nav2 = dt3.Rows[i]["Nav2"].ToString(); Lmlist.Add(lm); } ViewBag.PageName = Lmlist; } con.Close(); PetCareModel pml = new PetCareModel(); con.Open(); string querychk11 = "select * from PetCare where tid = " + Session["distid"].ToString() + " "; SqlDataAdapter dachk11 = new SqlDataAdapter(querychk11, con); DataTable dtchk11 = new DataTable(); dachk11.Fill(dtchk11); if (dtchk11.Rows.Count > 0) { pml.petname = dtchk11.Rows[0]["petname"].ToString(); pml.petage = dtchk11.Rows[0]["petage"].ToString(); pml.typeofpet = dtchk11.Rows[0]["typeofpet"].ToString(); pml.amtforpet = dtchk11.Rows[0]["amtforpet"].ToString(); pml.amtfromwhichasset = dtchk11.Rows[0]["amtfromwhichasset"].ToString(); pml.responsibelpersonforpet = dtchk11.Rows[0]["responsibelpersonforpet"].ToString(); pml.Proportion = Convert.ToInt32(dtchk11.Rows[0]["Proportion"]); string qqchk = "select AssetsType from AssetsType where atId = " + dtchk11.Rows[0]["assettypeid"].ToString() + " "; SqlDataAdapter dachk = new SqlDataAdapter(qqchk, con); DataTable dtchk = new DataTable(); dachk.Fill(dtchk); if (dtchk.Rows.Count > 0) { pml.assettypetext = dtchk.Rows[0]["AssetsType"].ToString(); } string qqchk2 = "select AssetsCategory from AssetsCategory where amId = " + dtchk11.Rows[0]["assetcategoryid"].ToString() + " "; SqlDataAdapter dachk2 = new SqlDataAdapter(qqchk2, con); DataTable dtchk2 = new DataTable(); dachk2.Fill(dtchk2); if (dtchk2.Rows.Count > 0) { pml.assetCategorytext = dtchk2.Rows[0]["AssetsCategory"].ToString(); } } con.Close(); return(View("~/Views/AddPetCare/AddPetCarePageContent.cshtml", pml)); }
public ActionResult InsertPetcaredata(PetCareModel PM) { ViewBag.collapse = "true"; // check type string typ = ""; con.Open(); string qq1 = "select Type from users where uId = " + Convert.ToInt32(Session["uuid"]) + " "; SqlDataAdapter daa = new SqlDataAdapter(qq1, con); DataTable dtt = new DataTable(); daa.Fill(dtt); con.Close(); if (dtt.Rows.Count > 0) { typ = dtt.Rows[0]["Type"].ToString(); } //end if (typ == "Testator") { // check will status con.Open(); string qry1 = "select Will from users where Will = 1 "; SqlDataAdapter daa1 = new SqlDataAdapter(qry1, con); DataTable dtt1 = new DataTable(); daa1.Fill(dtt1); if (dtt1.Rows.Count > 0) { ViewBag.documentbtn1 = "true"; } con.Close(); //end // check codocil status con.Open(); string qry2 = "select Codocil from users where Codocil = 1 "; SqlDataAdapter daa2 = new SqlDataAdapter(qry2, con); DataTable dtt2 = new DataTable(); daa2.Fill(dtt2); if (dtt2.Rows.Count > 0) { ViewBag.documentbtn2 = "true"; } con.Close(); //end // check Poa status con.Open(); string qry4 = "select POA from users where POA = 1 "; SqlDataAdapter daa4 = new SqlDataAdapter(qry4, con); DataTable dtt4 = new DataTable(); daa4.Fill(dtt4); if (dtt4.Rows.Count > 0) { ViewBag.documentbtn3 = "true"; } con.Close(); //end // check gift deeds status con.Open(); string qry3 = "select Giftdeeds from users where Giftdeeds = 1 "; SqlDataAdapter daa3 = new SqlDataAdapter(qry3, con); DataTable dtt3 = new DataTable(); daa3.Fill(dtt3); if (dtt3.Rows.Count > 0) { ViewBag.documentbtn4 = "true"; } con.Close(); //end } else { ViewBag.showtitle = "true"; ViewBag.documentlink = "true"; } List <LoginModel> Lmlist = new List <LoginModel>(); con.Open(); string q = "select * from Assignment_Roles where RoleId = " + Convert.ToInt32(Session["rId"]) + ""; SqlDataAdapter da3 = new SqlDataAdapter(q, con); DataTable dt3 = new DataTable(); da3.Fill(dt3); if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { LoginModel lm = new LoginModel(); lm.PageName = dt3.Rows[i]["PageName"].ToString(); lm.PageStatus = dt3.Rows[i]["PageStatus"].ToString(); lm.Action = dt3.Rows[i]["Action"].ToString(); lm.Nav1 = dt3.Rows[i]["Nav1"].ToString(); lm.Nav2 = dt3.Rows[i]["Nav2"].ToString(); Lmlist.Add(lm); } ViewBag.PageName = Lmlist; } con.Close(); con.Open(); string query = "insert into PetCare (petname,petage,typeofpet,amtforpet,amtfromwhichasset,responsibelpersonforpet,tid , assettypeid , assetcategoryid , Proportion) values ('" + PM.petname + "' , " + PM.petage + " , '" + PM.typeofpet + "' , " + PM.amtforpet + " ,'" + PM.amtfromwhichasset + "' , '" + PM.responsibelpersonforpet + "' , " + PM.ddltid + " , " + PM.assettypeid + " , " + PM.assetCategoryid + " , " + PM.Proportion + ")"; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); con.Close(); Session["totalpetcare"] = PM.Proportion; Session["assettypeidforpetcare"] = PM.assettypeid; Session["assetcategoryidforpetcare"] = PM.assetCategoryid; Session["assetcategoryidforliablities"] = ""; Session["assetcategorynameforliablities"] = ""; ViewBag.Message = "Verified"; ModelState.Clear(); ModelState.Clear(); return(View("~/Views/AddPetCare/AddPetCarePageContent.cshtml")); }
public ActionResult UpdatePetCareFormData(PetCareModel PM) { // check type string typ5 = ""; con.Open(); string qq15 = "select Type from users where uId = " + Convert.ToInt32(Session["uuid"]) + " "; SqlDataAdapter daa5 = new SqlDataAdapter(qq15, con); DataTable dtt5 = new DataTable(); daa5.Fill(dtt5); con.Close(); if (dtt5.Rows.Count > 0) { typ5 = dtt5.Rows[0]["Type"].ToString(); } //end if (typ5 == "Testator") { // check will status con.Open(); string qry1 = "select Will from users where Will = 1 "; SqlDataAdapter daa1 = new SqlDataAdapter(qry1, con); DataTable dtt1 = new DataTable(); daa1.Fill(dtt1); if (dtt1.Rows.Count > 0) { ViewBag.documentbtn1 = "true"; } con.Close(); //end // check codocil status con.Open(); string qry2 = "select Codocil from users where Codocil = 1 "; SqlDataAdapter daa2 = new SqlDataAdapter(qry2, con); DataTable dtt2 = new DataTable(); daa2.Fill(dtt2); if (dtt2.Rows.Count > 0) { ViewBag.documentbtn2 = "true"; } con.Close(); //end // check Poa status con.Open(); string qry4 = "select POA from users where POA = 1 "; SqlDataAdapter daa4 = new SqlDataAdapter(qry4, con); DataTable dtt4 = new DataTable(); daa4.Fill(dtt4); if (dtt4.Rows.Count > 0) { ViewBag.documentbtn3 = "true"; } con.Close(); //end // check gift deeds status con.Open(); string qry3 = "select Giftdeeds from users where Giftdeeds = 1 "; SqlDataAdapter daa3 = new SqlDataAdapter(qry3, con); DataTable dtt3 = new DataTable(); daa3.Fill(dtt3); if (dtt3.Rows.Count > 0) { ViewBag.documentbtn4 = "true"; } con.Close(); //end } else { ViewBag.showtitle = "true"; ViewBag.documentlink = "true"; } List <LoginModel> Lmlist = new List <LoginModel>(); con.Open(); string q = "select * from Assignment_Roles where RoleId = " + Convert.ToInt32(Session["rId"]) + ""; SqlDataAdapter da3 = new SqlDataAdapter(q, con); DataTable dt3 = new DataTable(); da3.Fill(dt3); if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { LoginModel lm = new LoginModel(); lm.PageName = dt3.Rows[i]["PageName"].ToString(); lm.PageStatus = dt3.Rows[i]["PageStatus"].ToString(); lm.Action = dt3.Rows[i]["Action"].ToString(); lm.Nav1 = dt3.Rows[i]["Nav1"].ToString(); lm.Nav2 = dt3.Rows[i]["Nav2"].ToString(); Lmlist.Add(lm); } ViewBag.PageName = Lmlist; } con.Close(); con.Open(); string query = "update PetCare set petname = '" + PM.petname + "' , petage=" + PM.petage + " ,typeofpet='" + PM.typeofpet + "' , amtforpet = " + PM.amtforpet + " , amtfromwhichasset = " + PM.amtfromwhichasset + " , responsibelpersonforpet=" + PM.responsibelpersonforpet + " , tid=" + PM.tid + " where petid =" + PM.petid + " "; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); con.Close(); ViewBag.Message = "Verified"; return(View("~/Views/UpdatePetCare/UpdatePetCarePageContent.cshtml")); }
// GET: UpdatePetCare public ActionResult UpdatePetCareIndex(int NestId) { // check type string typ = ""; con.Open(); string qq1 = "select Type from users where uId = " + Convert.ToInt32(Session["uuid"]) + " "; SqlDataAdapter daa = new SqlDataAdapter(qq1, con); DataTable dtt = new DataTable(); daa.Fill(dtt); con.Close(); if (dtt.Rows.Count > 0) { typ = dtt.Rows[0]["Type"].ToString(); } //end if (typ == "Testator") { con.Open(); string qq12 = "select Type from users where uId = " + Convert.ToInt32(Session["uuid"]) + " and designation = 1 "; SqlDataAdapter da42 = new SqlDataAdapter(qq12, con); DataTable d4t2 = new DataTable(); da42.Fill(d4t2); con.Close(); if (d4t2.Rows.Count > 0) { ViewBag.documentlink = "true"; } // check will status con.Open(); string qry1 = "select Will from users where Will = 1 "; SqlDataAdapter daa1 = new SqlDataAdapter(qry1, con); DataTable dtt1 = new DataTable(); daa1.Fill(dtt1); if (dtt1.Rows.Count > 0) { ViewBag.documentbtn1 = "true"; } con.Close(); //end // check codocil status con.Open(); string qry2 = "select Codocil from users where Codocil = 1 "; SqlDataAdapter daa2 = new SqlDataAdapter(qry2, con); DataTable dtt2 = new DataTable(); daa2.Fill(dtt2); if (dtt2.Rows.Count > 0) { ViewBag.documentbtn2 = "true"; } con.Close(); //end // check Poa status con.Open(); string qry4 = "select POA from users where POA = 1 "; SqlDataAdapter daa4 = new SqlDataAdapter(qry4, con); DataTable dtt4 = new DataTable(); daa4.Fill(dtt4); if (dtt4.Rows.Count > 0) { ViewBag.documentbtn3 = "true"; } con.Close(); //end // check gift deeds status con.Open(); string qry3 = "select Giftdeeds from users where Giftdeeds = 1 "; SqlDataAdapter daa3 = new SqlDataAdapter(qry3, con); DataTable dtt3 = new DataTable(); daa3.Fill(dtt3); if (dtt3.Rows.Count > 0) { ViewBag.documentbtn4 = "true"; } con.Close(); //end } else { ViewBag.showtitle = "true"; ViewBag.documentlink = "true"; } if (Session["rId"] == null || Session["uuid"] == null) { RedirectToAction("LoginPageIndex", "LoginPage"); } //if (Session["tid"]== null) //{ // ViewBag.message = "link"; //} List <LoginModel> Lmlist = new List <LoginModel>(); con.Open(); string q = "select * from Assignment_Roles where RoleId = " + Convert.ToInt32(Session["rId"]) + ""; SqlDataAdapter da3 = new SqlDataAdapter(q, con); DataTable dt3 = new DataTable(); da3.Fill(dt3); if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { LoginModel lm = new LoginModel(); lm.PageName = dt3.Rows[i]["PageName"].ToString(); lm.PageStatus = dt3.Rows[i]["PageStatus"].ToString(); lm.Action = dt3.Rows[i]["Action"].ToString(); lm.Nav1 = dt3.Rows[i]["Nav1"].ToString(); lm.Nav2 = dt3.Rows[i]["Nav2"].ToString(); Lmlist.Add(lm); } ViewBag.PageName = Lmlist; } con.Close(); PetCareModel PM = new PetCareModel(); con.Open(); string query = "select * from PetCare where petid = " + NestId + " "; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); if (dt.Rows.Count > 0) { PM.petid = Convert.ToInt32(dt.Rows[0]["petid"]); PM.petname = dt.Rows[0]["petname"].ToString(); PM.petage = dt.Rows[0]["petage"].ToString(); PM.typeofpet = dt.Rows[0]["typeofpet"].ToString(); PM.amtforpet = dt.Rows[0]["amtforpet"].ToString(); PM.amtfromwhichasset = dt.Rows[0]["amtfromwhichasset"].ToString(); PM.responsibelpersonforpet = dt.Rows[0]["responsibelpersonforpet"].ToString(); } return(View("~/Views/UpdatePetCare/UpdatePetCarePageContent.cshtml", PM)); }