//构造方法 public LiabilitiesService() { try { //获取token string token = FinanceToken.getFinanceCheckToken().getToken(); //获取对象 account = FinanceToken.getFinanceCheckToken().checkToken(token); //实例化model层 liabilitiesModel = new LiabilitiesModel(); }catch { throw new InvalidOperationException("身份验证不通过"); } }
public ActionResult UpdateLiabilitiesdetails(LiabilitiesModel LM) { // 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 Liabilities set Amount= " + LM.Amount + " , Name = " + LM.Name1 + " , address=" + LM.address + " , city = " + LM.citytext + " state = " + LM.statetext + " , pin=" + LM.pin + " , Mobile=" + LM.Mobile + " , Details=" + LM.Details + " , tid=" + LM.tid + " where lId =" + LM.libid + " "; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); con.Close(); ViewBag.Message = "Verified"; return(View("~/Views/UpdateLiabilities/UpdateLiabilitiesPageContent.cshtml")); }
// GET: AddLiabilities public ActionResult AddLiabilitiesIndex() { 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(); LiabilitiesModel lml = new LiabilitiesModel(); con.Open(); string querychk11 = "select * from Liabilities where tid = " + Session["distid"].ToString() + " "; SqlDataAdapter dachk11 = new SqlDataAdapter(querychk11, con); DataTable dtchk11 = new DataTable(); dachk11.Fill(dtchk11); if (dtchk11.Rows.Count > 0) { lml.Amount = Convert.ToInt32(dtchk11.Rows[0]["Amount"]); lml.Name1 = dtchk11.Rows[0]["Name"].ToString(); lml.address = dtchk11.Rows[0]["address"].ToString(); lml.citytext = dtchk11.Rows[0]["city"].ToString(); lml.statetext = dtchk11.Rows[0]["state"].ToString(); lml.pin = dtchk11.Rows[0]["pin"].ToString(); lml.Mobile = dtchk11.Rows[0]["Mobile"].ToString(); lml.Details = dtchk11.Rows[0]["Details"].ToString(); 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) { lml.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) { lml.assetCategorytext = dtchk2.Rows[0]["AssetsCategory"].ToString(); } lml.Proportion = Convert.ToInt32(dtchk11.Rows[0]["Proportion"]); } con.Close(); return(View("~/Views/AddLiabilities/AddLiabilitiesPageContent.cshtml", lml)); }
// GET: UpdateLiabilities public ActionResult UpdateLiabilitiesIndex(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(); LiabilitiesModel LM = new LiabilitiesModel(); con.Open(); string query = "select * from Liabilities where lId = " + NestId + " "; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); LM.libid = Convert.ToInt32(dt.Rows[0]["lId"]); LM.Amount = Convert.ToInt32(dt.Rows[0]["Amount"]); LM.Type = dt.Rows[0]["Type"].ToString(); LM.Name1 = dt.Rows[0]["Name"].ToString(); LM.address = dt.Rows[0]["address"].ToString(); LM.citytext = dt.Rows[0]["city"].ToString(); LM.statetext = dt.Rows[0]["state"].ToString(); LM.pin = dt.Rows[0]["pin"].ToString(); LM.Mobile = dt.Rows[0]["Mobile"].ToString(); LM.Details = dt.Rows[0]["Details"].ToString(); return(View("~/Views/UpdateLiabilities/UpdateLiabilitiesPageContent.cshtml", LM)); }
public ActionResult InsertLiabilitiesDetails(LiabilitiesModel LM) { 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 Liabilities (Amount , Name , address , city , state , pin , Mobile , Details , tid , assettypeid , assetcategoryid , Proportion) values (" + LM.Amount + " , '" + LM.Name1 + "' , '" + LM.address + "' , '" + LM.citytext + "' , '" + LM.statetext + "' , '" + LM.pin + "' , '" + LM.Mobile + "' , '" + LM.Details + "' , " + LM.ddltid + " , " + LM.assettypeid + " , " + LM.assetCategoryid + " , " + LM.Proportion + " ) "; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); con.Close(); Session["totalliablities"] = LM.Proportion; Session["assetcategoryidforliablities"] = LM.assetCategoryid; Session["assetcategorynameforliablities"] = LM.assetCategorytext; ViewBag.Message = "Verified"; ModelState.Clear(); return(View("~/Views/AddLiabilities/AddLiabilitiesPageContent.cshtml")); }