// GET: UpdateAlternateAppointees
        public ActionResult UpdateAlternateAppointeesIndex(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();
            AlternateAppointeesModel Am = new AlternateAppointeesModel();

            Am.id = NestId;

            con.Open();
            string         query = "select * from alternate_Appointees where id = " + NestId + "";
            SqlDataAdapter da    = new SqlDataAdapter(query, con);
            DataTable      dt    = new DataTable();

            da.Fill(dt);
            con.Close();
            string data = "";

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Am.Name                     = dt.Rows[i]["Name"].ToString();
                    Am.middleName               = dt.Rows[i]["middleName"].ToString();
                    Am.Surname                  = dt.Rows[i]["Surname"].ToString();
                    Am.Identity_Proof           = dt.Rows[i]["Identity_Proof"].ToString();
                    Am.Identity_Proof_Value     = dt.Rows[i]["Identity_Proof_Value"].ToString();
                    Am.Alt_Identity_Proof       = dt.Rows[i]["Alt_Identity_Proof"].ToString();
                    Am.Alt_Identity_Proof_Value = dt.Rows[i]["Alt_Identity_Proof_Value"].ToString();

                    Am.Dob = dt.Rows[i]["DOB"].ToString();

                    Am.Gender          = dt.Rows[i]["Gender"].ToString();
                    Am.Occupation      = dt.Rows[i]["Occupation"].ToString();
                    Am.RelationshipTxt = dt.Rows[i]["Relationship"].ToString();
                    Am.Address1        = dt.Rows[i]["Address1"].ToString();
                    Am.Address2        = dt.Rows[i]["Address2"].ToString();
                    Am.Address3        = dt.Rows[i]["Address3"].ToString();
                    Am.citytext        = dt.Rows[i]["City"].ToString();
                    Am.statetext       = dt.Rows[i]["State"].ToString();
                    Am.Pin             = dt.Rows[i]["Pin"].ToString();
                }
            }
            return(View("~/Views/UpdateAlternateAppointees/UpdateAlternateAppointeesPageContent.cshtml", Am));
        }
        public ActionResult UpdatingAppointeesFormData(AlternateAppointeesModel AM)
        {
            // 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


            AM.documentId = 0;

            con.Open();
            SqlCommand cmd = new SqlCommand("SP_CRUDAlternateAppointees", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@condition", "update");
            cmd.Parameters.AddWithValue("@id", AM.id);
            cmd.Parameters.AddWithValue("@apId", AM.apId);


            cmd.Parameters.AddWithValue("@Name", AM.Name);
            cmd.Parameters.AddWithValue("@middleName", AM.middleName);
            cmd.Parameters.AddWithValue("@Surname", AM.Surname);
            cmd.Parameters.AddWithValue("@Identity_proof", AM.Identity_Proof);
            cmd.Parameters.AddWithValue("@Identity_proof_value", AM.Identity_Proof_Value);
            cmd.Parameters.AddWithValue("@Alt_Identity_proof", AM.Alt_Identity_Proof);
            cmd.Parameters.AddWithValue("@Alt_Identity_proof_value", AM.Alt_Identity_Proof_Value);
            DateTime dat = DateTime.ParseExact(AM.Dob, "dd-MM-yyyy", CultureInfo.InvariantCulture);

            cmd.Parameters.AddWithValue("@DOB", dat);
            cmd.Parameters.AddWithValue("@Gender", AM.Gender);
            cmd.Parameters.AddWithValue("@Occupation", AM.Occupation);
            cmd.Parameters.AddWithValue("@Relationship", AM.RelationshipTxt);
            cmd.Parameters.AddWithValue("@Address1", AM.Address1);
            cmd.Parameters.AddWithValue("@Address2", AM.Address2);
            cmd.Parameters.AddWithValue("@Address3", AM.Address3);
            cmd.Parameters.AddWithValue("@City", AM.citytext);
            cmd.Parameters.AddWithValue("@State", AM.statetext);
            cmd.Parameters.AddWithValue("@Pin", AM.Pin);
            cmd.ExecuteNonQuery();
            con.Close();

            return(View("~/Views/UpdateAlternateAppointees/UpdateAlternateAppointeesPageContent.cshtml"));
        }
Пример #3
0
        public ActionResult InsertAlternateAppointeesFormData(AlternateAppointeesModel AM)
        {
            // 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


            int getAlternateGaurdian = 0;
            int getAlternateExecutors = 0;


            //if (Session["apId"] != null)
            //{
                getAlternateExecutors = 1;
                getAlternateGaurdian = 1;

            //string apid = Session["apId"].ToString();
            string apid = "";
            con.Open();
                SqlCommand cmd = new SqlCommand("SP_CRUDAlternateAppointees", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@condition", "insert");
                cmd.Parameters.AddWithValue("@apId", Convert.ToInt32(apid.ToString()));

                cmd.Parameters.AddWithValue("@Name", AM.Name);
                cmd.Parameters.AddWithValue("@middleName", AM.middleName);
                cmd.Parameters.AddWithValue("@Surname", AM.Surname);
                cmd.Parameters.AddWithValue("@Identity_proof", AM.Identity_Proof);
                cmd.Parameters.AddWithValue("@Identity_proof_value", AM.Identity_Proof_Value);
                cmd.Parameters.AddWithValue("@Alt_Identity_proof", AM.Alt_Identity_Proof);
                cmd.Parameters.AddWithValue("@Alt_Identity_proof_value", AM.Alt_Identity_Proof_Value);
                DateTime dat = DateTime.ParseExact(AM.Dob, "dd-MM-yyyy", CultureInfo.InvariantCulture);
                cmd.Parameters.AddWithValue("@DOB", dat);
                cmd.Parameters.AddWithValue("@Gender", AM.Gender);
                cmd.Parameters.AddWithValue("@Occupation", AM.Occupation);
                cmd.Parameters.AddWithValue("@Relationship", AM.RelationshipTxt);
                cmd.Parameters.AddWithValue("@Address1", AM.Address1);
                cmd.Parameters.AddWithValue("@Address2", AM.Address2);
                cmd.Parameters.AddWithValue("@Address3", AM.Address3);
                cmd.Parameters.AddWithValue("@City", AM.citytext);
                cmd.Parameters.AddWithValue("@State", AM.statetext);
                cmd.Parameters.AddWithValue("@Pin", AM.Pin);
                cmd.Parameters.AddWithValue("@tid",  "");
                cmd.ExecuteNonQuery();
                con.Close();
                ViewBag.Message = "Verified";
            }