public async Task <ActionResult> Update([FromBody] RoleFormModel model, int roleId) { var entity = Roles.GetRole(roleId); var user = Users.GetUser(model.UserId); var library = Libraries.GetLibrary(model.LibraryId); if (entity == null) { return(NotFound()); } if (user == null) { return(NotFound()); } if (library == null) { return(NotFound()); } entity.User = user; entity.Library = library; Roles.Update(entity, model); return(Accepted()); }
public Role Update(Role entity, RoleFormModel model) { Mapper.Map(model, entity); Update(entity); SaveChanges(); return(entity); }
public async Task <ActionResult> Create([FromBody] RoleFormModel model) { var entity = Mapper.Map <Role>(model); var user = Users.GetUser(model.UserId); var library = Libraries.GetLibrary(model.LibraryId); if (user == null) { return(NotFound()); } entity.User = user; if (library == null) { return(NotFound()); } entity.Library = library; Libraries.Create(entity); return(CreatedAtAction(nameof(Fetch), new { roleId = entity.RoleId }, Mapper.Map <RoleFormModel>(entity))); }
public string DeletevisitorRecords(RoleFormModel RFM) { int index = Convert.ToInt32(Request["send"]); con.Open(); string query = "delete from visitorinfo where vid = " + Response + " )"; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); con.Close(); // 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.documentlink = "true"; } // check roles 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); } } con.Close(); //end con.Open(); string query2 = "select * from visitorinfo"; SqlDataAdapter da = new SqlDataAdapter(query2, con); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); string data = ""; string testString = ""; for (int i = 0; i < Lmlist.Count(); i++) { testString = Lmlist[0].Action; } if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["vid"].ToString() + "</td>" + "<td>" + dt.Rows[i]["First_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Middle_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Last_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Mobile"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Email"].ToString() + "</td>" + "<td>" + dt.Rows[i]["RefDist"].ToString() + "</td>" + "<td>" + dt.Rows[i]["DocumentType"].ToString() + "</td>" + "<td> <button type='button' id='" + dt.Rows[i]["vid"].ToString() + "' onClick='Edit(this.id)' class='btn btn-primary'>Edit</button><button type='button' id=" + dt.Rows[i]["vid"].ToString() + " class='btn btn-danger deletenotification'>Delete</button> <button type='button' id=" + dt.Rows[i]["vid"].ToString() + " onClick='verifydoc(this.id)' class='btn btn-success deletenotification'>Verify Visitor</button></td></tr>"; } } return(data); }
public string DeleteCouponsDataRecords(RoleFormModel RFM) { int index = Convert.ToInt32(Request["send"]); con.Open(); SqlCommand cmd = new SqlCommand("SP_CRUDdiscountpercentage", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@condition", "delete"); cmd.Parameters.AddWithValue("@id", index); cmd.Parameters.AddWithValue("@Coupon_Number", ""); cmd.Parameters.AddWithValue("@Discount_Percentge", ""); cmd.Parameters.AddWithValue("@Description", ""); cmd.Parameters.AddWithValue("@status", ""); cmd.ExecuteNonQuery(); con.Close(); // 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.documentlink = "true"; } // check roles 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); } } con.Close(); //end con.Open(); string query = "select * from discountCoupons"; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); string data = ""; string testString = ""; for (int i = 0; i < Lmlist.Count(); i++) { testString = Lmlist[7].Action; } if (dt.Rows.Count > 0) { if (testString == "1,2,0" || testString == "0,2,0" || testString == "0,2,3" || testString == "0,2,3" || testString == "0,2,0") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["Id"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Coupon_Number"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Discount_Percentge"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Description"].ToString() + "</td>" + "<td>" + dt.Rows[i]["status"].ToString() + "</td>" + "<td> <button type='button' id='" + dt.Rows[i]["Id"].ToString() + "' onClick='Edit(this.id)' class='btn btn-primary'>Edit</button></td></tr>"; } } if (testString == "1,0,3" || testString == "0,0,3" || testString == "0,2,3" || testString == "1,0,3" || testString == "0,0,3") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["id"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Coupon_Number"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Discount_Percentge"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Description"].ToString() + "</td>" + "<td>" + dt.Rows[i]["status"].ToString() + "</td>" + "<td><button type='button' id=" + dt.Rows[i]["Id"].ToString() + " class='btn btn-danger deletenotification'>Delete</button></td></tr>"; } } if (testString == "1,2,3" || testString == "0,2,3") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["id"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Coupon_Number"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Discount_Percentge"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Description"].ToString() + "</td>" + "<td>" + dt.Rows[i]["status"].ToString() + "</td>" + "<td> <button type='button' id='" + dt.Rows[i]["Id"].ToString() + "' onClick='Edit(this.id)' class='btn btn-primary'>Edit</button><button type='button' id=" + dt.Rows[i]["Id"].ToString() + " class='btn btn-danger deletenotification'>Delete</button></td></tr>"; } } if (testString == "0,0,0") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["rId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Coupon_Number"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Discount_Percentge"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Description"].ToString() + "</td>" + "<td>" + dt.Rows[i]["status"].ToString() + "</td>"; } } } return(data); }
public string DeleteCompanyRecords(RoleFormModel RFM) { // 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.documentlink = "true"; } int index = Convert.ToInt32(Request["send"]); con.Open(); SqlCommand cmd = new SqlCommand("SP_Roles", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@condition", "delete"); cmd.Parameters.AddWithValue("@roleid", index); cmd.Parameters.AddWithValue("@Role", ""); cmd.Parameters.AddWithValue("@pid", ""); cmd.ExecuteNonQuery(); con.Close(); // check roles 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); } } con.Close(); //end con.Open(); string query = "select * from companyDetails"; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); string data = ""; string testString = ""; for (int i = 0; i < Lmlist.Count(); i++) { testString = Lmlist[0].Action; } if (dt.Rows.Count > 0) { if (testString == "1,2,0" || testString == "0,2,0" || testString == "0,2,3" || testString == "0,2,3" || testString == "0,2,0") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["compId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["companyName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["ownerName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["ownerMobileNo"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address1"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address2"].ToString() + "</td>" + "<td>" + dt.Rows[i]["City"].ToString() + "</td>" + "<td>" + dt.Rows[i]["State"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Pin"].ToString() + "</td>" + "<td>" + dt.Rows[i]["GST_NO"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["contactPerson"].ToString() + "</td>" + "<td>" + dt.Rows[i]["contactMobileNo"].ToString() + "</td>" + "<td>" + dt.Rows[i]["contactMailId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["bankName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Branch"].ToString() + "</td>" + "<td>" + dt.Rows[i]["accountNumber"].ToString() + "</td>" + "<td>" + dt.Rows[i]["IFSC_Code"].ToString() + "</td>" + "<td>" + dt.Rows[i]["accountName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Referred_By"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadgeneratedBy"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadconvertedBy"].ToString() + "</td>" + "<td>" + dt.Rows[i]["relationshipManager"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadStatus"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadRemark"].ToString() + "</td>" + "<td> <button type='button' id='" + dt.Rows[i]["compId"].ToString() + "' onClick='Edit(this.id)' class='btn btn-primary'>Edit</button></td></tr>"; } } if (testString == "1,0,3" || testString == "0,0,3" || testString == "0,2,3" || testString == "1,0,3" || testString == "0,0,3") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["compId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["companyName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["ownerName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["ownerMobileNo"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address1"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address2"].ToString() + "</td>" + "<td>" + dt.Rows[i]["City"].ToString() + "</td>" + "<td>" + dt.Rows[i]["State"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Pin"].ToString() + "</td>" + "<td>" + dt.Rows[i]["GST_NO"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["contactPerson"].ToString() + "</td>" + "<td>" + dt.Rows[i]["contactMobileNo"].ToString() + "</td>" + "<td>" + dt.Rows[i]["contactMailId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["bankName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Branch"].ToString() + "</td>" + "<td>" + dt.Rows[i]["accountNumber"].ToString() + "</td>" + "<td>" + dt.Rows[i]["IFSC_Code"].ToString() + "</td>" + "<td>" + dt.Rows[i]["accountName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Referred_By"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadgeneratedBy"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadconvertedBy"].ToString() + "</td>" + "<td>" + dt.Rows[i]["relationshipManager"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadStatus"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadRemark"].ToString() + "</td>" + "<td><button type='button' id=" + dt.Rows[i]["compId"].ToString() + " class='btn btn-danger deletenotification'>Delete</button></td></tr>"; } } if (testString == "1,2,3" || testString == "0,2,3") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["compId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["companyName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["ownerName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["ownerMobileNo"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address1"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address2"].ToString() + "</td>" + "<td>" + dt.Rows[i]["City"].ToString() + "</td>" + "<td>" + dt.Rows[i]["State"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Pin"].ToString() + "</td>" + "<td>" + dt.Rows[i]["GST_NO"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["contactPerson"].ToString() + "</td>" + "<td>" + dt.Rows[i]["contactMobileNo"].ToString() + "</td>" + "<td>" + dt.Rows[i]["contactMailId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["bankName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Branch"].ToString() + "</td>" + "<td>" + dt.Rows[i]["accountNumber"].ToString() + "</td>" + "<td>" + dt.Rows[i]["IFSC_Code"].ToString() + "</td>" + "<td>" + dt.Rows[i]["accountName"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Referred_By"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadgeneratedBy"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadconvertedBy"].ToString() + "</td>" + "<td>" + dt.Rows[i]["relationshipManager"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadStatus"].ToString() + "</td>" + "<td>" + dt.Rows[i]["leadRemark"].ToString() + "</td>" + "<td> <button type='button' id='" + dt.Rows[i]["compId"].ToString() + "' onClick='Edit(this.id)' class='btn btn-primary'>Edit</button><button type='button' id=" + dt.Rows[i]["compId"].ToString() + " class='btn btn-danger deletenotification'>Delete</button></td></tr>"; } } if (testString == "0,0,0") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["compId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["compId"].ToString() + "</td>"; } } } return(data); }
public ActionResult UpdatingRoles(RoleFormModel RFM) { // 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"; } // roleassignment 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(); //end con.Open(); SqlCommand cmd = new SqlCommand("SP_Roles", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@condition", "update"); cmd.Parameters.AddWithValue("@roleid ", RFM.RoleID); cmd.Parameters.AddWithValue("@role ", RFM.Role); cmd.Parameters.AddWithValue("@pid ", ""); cmd.ExecuteNonQuery(); con.Close(); ViewBag.Message = "Verified"; return(View("~/Views/UpdateRoles/UpdateRolesPageContent.cshtml")); }
// GET: UpdateRoles public ActionResult UpdateRolesIndex(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(); RoleFormModel RFM = new RoleFormModel(); con.Open(); string query = "select * from Roles where rid = '" + NestId + "' "; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); if (dt.Rows.Count > 0) { RFM.RoleID = NestId; RFM.Role = dt.Rows[0]["Role"].ToString(); } return(View("~/Views/UpdateRoles/UpdateRolesPageContent.cshtml", RFM)); }
public IActionResult CreateOrUpdate(RoleFormModel form) { _roleService.CreateOrUpdate(form.Role, form.AssignedClaims); return(RedirectToAction("Index")); }
public ActionResult InsertSetting(RoleFormModel RFM) { // 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"; } // roleassignment List <LoginModel> Lmlist = new List <LoginModel>(); 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; //end con.Open(); string query = "insert into Settings_vals (documentType,Value) values ('" + RFM.documenttype + "' , '" + RFM.value + "')"; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); con.Close(); ViewBag.Message = "verified"; ModelState.Clear(); } return(View("~/Views/Settings/SettingsPageContent.cshtml")); }
public string DeletealtbeneficiaryRecords(RoleFormModel RFM) { int index = Convert.ToInt32(Request["send"]); con.Open(); SqlCommand cmd = new SqlCommand("SP_CRUD_alternate_Beneficiary", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@condition", "insert"); cmd.Parameters.AddWithValue("@lnk_bd_id", index); cmd.Parameters.AddWithValue("@bpId", ""); cmd.Parameters.AddWithValue("@First_Name", ""); cmd.Parameters.AddWithValue("@Last_Name", ""); cmd.Parameters.AddWithValue("@Middle_Name", ""); cmd.Parameters.AddWithValue("@DOB", ""); cmd.Parameters.AddWithValue("@Mobile", ""); cmd.Parameters.AddWithValue("@Relationship", ""); cmd.Parameters.AddWithValue("@Marital_Status", ""); cmd.Parameters.AddWithValue("@Religion", ""); cmd.Parameters.AddWithValue("@Identity_Proof", ""); cmd.Parameters.AddWithValue("@Identity_Proof_Value", ""); cmd.Parameters.AddWithValue("@Alt_Identity_Proof", ""); cmd.Parameters.AddWithValue("@Alt_Identity_Proof_Value", ""); cmd.Parameters.AddWithValue("@Address1", ""); cmd.Parameters.AddWithValue("@Address2", ""); cmd.Parameters.AddWithValue("@Address3", ""); cmd.Parameters.AddWithValue("@City", ""); cmd.Parameters.AddWithValue("@State", ""); cmd.Parameters.AddWithValue("@Pin", ""); cmd.ExecuteNonQuery(); con.Close(); // check roles 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); } } con.Close(); //end string testString = ""; for (int i = 0; i < Lmlist.Count(); i++) { testString = Lmlist[13].Action; } con.Open(); string query = "select a.lnk_bd_id , a.bpId , a.First_Name , a.Last_Name , a.Middle_Name , a.DOB , a.Mobile , a.Relationship , a.Marital_Status , a.Religion , a.Identity_Proof , a.Identity_Proof_Value , a.Alt_Identity_Proof , a.Alt_Identity_Proof_Value , a.Address1 , a.Address2 , a.Address3 , a.City , a.State , a.Pin from alternate_Beneficiary a inner join BeneficiaryDetails b on a.bpId=b.bpId inner join TestatorDetails c on b.tId=c.tId where c.uId = " + Convert.ToInt32(Session["uuid"]) + " "; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); string data = ""; if (dt.Rows.Count > 0) { if (testString == "1,2,0" || testString == "0,2,0" || testString == "0,2,3" || testString == "0,2,3" || testString == "0,2,0") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["lnk_bd_id"].ToString() + "</td>" + "<td>" + dt.Rows[i]["bpId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["First_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Last_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Middle_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["DOB"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Mobile"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Relationship"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Marital_Status"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Religion"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address1"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address2"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address3"].ToString() + "</td>" + "<td>" + dt.Rows[i]["City"].ToString() + "</td>" + "<td>" + dt.Rows[i]["State"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Pin"].ToString() + "</td>" + "<td><button type='button' id='" + dt.Rows[i]["lnk_bd_id"].ToString() + "' onClick='Edit(this.id)' class='btn btn-primary'>Edit</button></td> </tr>"; } } if (testString == "1,0,3" || testString == "0,0,3" || testString == "0,2,3" || testString == "1,0,3" || testString == "0,0,3") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["lnk_bd_id"].ToString() + "</td>" + "<td>" + dt.Rows[i]["bpId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["First_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Last_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Middle_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["DOB"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Mobile"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Relationship"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Marital_Status"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Religion"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address1"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address2"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address3"].ToString() + "</td>" + "<td>" + dt.Rows[i]["City"].ToString() + "</td>" + "<td>" + dt.Rows[i]["State"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Pin"].ToString() + "</td>" + "<td><button type='button' id='" + dt.Rows[i]["lnk_bd_id"].ToString() + "' class='btn btn-danger deletenotification'>Delete</button></td> </tr>"; } } if (testString == "1,2,3" || testString == "0,2,3") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["lnk_bd_id"].ToString() + "</td>" + "<td>" + dt.Rows[i]["bpId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["First_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Last_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Middle_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["DOB"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Mobile"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Relationship"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Marital_Status"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Religion"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address1"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address2"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address3"].ToString() + "</td>" + "<td>" + dt.Rows[i]["City"].ToString() + "</td>" + "<td>" + dt.Rows[i]["State"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Pin"].ToString() + "</td>" + "<td><button type='button' id='" + dt.Rows[i]["lnk_bd_id"].ToString() + "' onClick='Edit(this.id)' class='btn btn-primary'>Edit</button><button type='button' id='" + dt.Rows[i]["lnk_bd_id"].ToString() + "' class='btn btn-danger deletenotification'>Delete</button></td> </tr>"; } } if (testString == "0,0,0") { for (int i = 0; i < dt.Rows.Count; i++) { data = data + "<tr class='nr'><td>" + dt.Rows[i]["lnk_bd_id"].ToString() + "</td>" + "<td>" + dt.Rows[i]["bpId"].ToString() + "</td>" + "<td>" + dt.Rows[i]["First_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Last_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Middle_Name"].ToString() + "</td>" + "<td>" + dt.Rows[i]["DOB"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Mobile"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Relationship"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Marital_Status"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Religion"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Alt_Identity_Proof_Value"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address1"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address2"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Address3"].ToString() + "</td>" + "<td>" + dt.Rows[i]["City"].ToString() + "</td>" + "<td>" + dt.Rows[i]["State"].ToString() + "</td>" + "<td>" + dt.Rows[i]["Pin"].ToString() + "</td>"; } } } return(data); }
public string DeleteMappedRecords(RoleFormModel RFM) { string final = ""; int index = Convert.ToInt32(Request["send"]); con.Open(); string query1 = "delete from AssetInformation where aiid = " + index + " "; SqlCommand cmd = new SqlCommand(query1, con); cmd.ExecuteNonQuery(); con.Close(); // 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.documentlink = "true"; } // check roles 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); } } con.Close(); //end string testString = ""; for (int i = 0; i < Lmlist.Count(); i++) { testString = Lmlist[18].Action; } // string final = ""; con.Open(); string query = "select a.aiid , c.AssetsType , d.AssetsCategory , a.tid , a.docid , a.Json from AssetInformation a inner join TestatorDetails b on a.tid=b.tId inner join AssetsType c on a.atId = c.atId inner join AssetsCategory d on a.amId=d.amId inner join users e on e.uId=b.uId where e.Linked_user = "******"uuid"]) + " "; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); string data = ""; for (int i = 0; i < dt.Rows.Count; i++) { string getjson = dt.Rows[i]["Json"].ToString(); var dict = JsonConvert.DeserializeObject <Dictionary <string, string> >(getjson); foreach (var kv in dict) { final = final + kv.Key + ":" + kv.Value; } if (testString == "1,2,0" || testString == "0,2,0" || testString == "0,2,3" || testString == "0,2,3" || testString == "0,2,0") { data = data + "<tr class='nr'><td>" + dt.Rows[i]["aiid"].ToString() + "</td>"; data += "<td>" + dt.Rows[i]["AssetsType"].ToString() + "</td>"; data += "<td>" + dt.Rows[i]["AssetsCategory"].ToString() + "</td>"; data += "<td>" + final + "</td>"; data += "<td><button type='button' id='" + dt.Rows[i]["aiid"].ToString() + "' onClick='Edit(this.id)' class='btn btn-primary'>Edit</button></td></tr>"; } if (testString == "1,0,3" || testString == "0,0,3" || testString == "0,2,3" || testString == "1,0,3" || testString == "0,0,3") { data = data + "<tr class='nr'><td>" + dt.Rows[i]["aiid"].ToString() + "</td>"; data += "<td>" + dt.Rows[i]["AssetsType"].ToString() + "</td>"; data += "<td>" + dt.Rows[i]["AssetsCategory"].ToString() + "</td>"; data += "<td>" + final + "</td>"; data += "<td><button type='button' id='" + dt.Rows[i]["aiid"].ToString() + "' class='btn btn-danger deletenotification'>Delete</button> </td></tr>"; } if (testString == "1,2,3" || testString == "0,2,3") { data = data + "<tr class='nr'><td>" + dt.Rows[i]["aiid"].ToString() + "</td>"; data += "<td>" + dt.Rows[i]["AssetsType"].ToString() + "</td>"; data += "<td>" + dt.Rows[i]["AssetsCategory"].ToString() + "</td>"; data += "<td>" + final + "</td>"; data += "<td><button type='button' id='" + dt.Rows[i]["aiid"].ToString() + "' onClick='Edit(this.id)' class='btn btn-primary'>Edit</button><button type='button' id='" + dt.Rows[i]["aiid"].ToString() + "' class='btn btn-danger deletenotification'>Delete</button> </td></tr>"; } if (testString == "0,0,0") { data = data + "<tr class='nr'><td>" + dt.Rows[i]["aiid"].ToString() + "</td>"; data += "<td>" + dt.Rows[i]["AssetsType"].ToString() + "</td>"; data += "<td>" + dt.Rows[i]["AssetsCategory"].ToString() + "</td>"; data += "<td>" + final + "</td>"; } } return(data); }
public ActionResult InsertRoleFormData(RoleFormModel RFM) { // 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"; } // roleassignment List <LoginModel> Lmlist = new List <LoginModel>(); 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; //end } int roles = 0; roles = Convert.ToInt32(Session["rId"]); //main Roles //con.Open(); //string query = "select count(*) from Roles where Role = '" + RFM.Role + "'"; //SqlCommand cmd = new SqlCommand(query, con); //int count = (int)cmd.ExecuteScalar(); //if (count > 0) //{ // ViewBag.Message = "Duplicate"; //} //else //{ con.Open(); SqlCommand cmd2 = new SqlCommand("SP_Roles", con); cmd2.CommandType = System.Data.CommandType.StoredProcedure; cmd2.Parameters.AddWithValue("@condition", "insert"); cmd2.Parameters.AddWithValue("@role ", RFM.Role); cmd2.Parameters.AddWithValue("@pid ", Convert.ToInt32(Session["uuid"])); cmd2.ExecuteNonQuery(); ViewBag.Message = "Verified"; //} con.Close(); return(View("~/Views/RoleAdd/AddRoleContentPage.cshtml")); }