Beispiel #1
0
        public ActionResult InsertUserFormData(DistributorFormModel DFM)
        {
            // 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();



            con.Close();


            return(View("~/Views/AddDistributor/AddDistributorPageContent.cshtml"));
        }
Beispiel #2
0
        public string DeleteDistributorFormRecords(DistributorFormModel DFM)
        {
            int index = Convert.ToInt32(Request["send"]);

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

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@condition", "delete");
            cmd.Parameters.AddWithValue("@compId ", index);
            cmd.Parameters.AddWithValue("@companyName ", "");
            cmd.Parameters.AddWithValue("@ownerName", "");
            cmd.Parameters.AddWithValue("@ownerMobileNo", "");
            cmd.Parameters.AddWithValue("@Address1", "");
            cmd.Parameters.AddWithValue("@Address2", "");
            cmd.Parameters.AddWithValue("@City", "");
            cmd.Parameters.AddWithValue("@State", "");
            cmd.Parameters.AddWithValue("@Pin", "");
            cmd.Parameters.AddWithValue("@GST_NO", "");
            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("@contactPerson", "");
            cmd.Parameters.AddWithValue("@contactMobileNo", "");
            cmd.Parameters.AddWithValue("@contactMailId", "");
            cmd.Parameters.AddWithValue("@bankName", "");
            cmd.Parameters.AddWithValue("@Branch", "");
            cmd.Parameters.AddWithValue("@accountNumber", "");
            cmd.Parameters.AddWithValue("@IFSC_Code", "");
            cmd.Parameters.AddWithValue("@accountName", "");
            cmd.Parameters.AddWithValue("@Referred_By", "");
            cmd.Parameters.AddWithValue("@leadgeneratedBy", "");
            cmd.Parameters.AddWithValue("@leadconvertedBy", "");
            cmd.Parameters.AddWithValue("@relationshipManager", "");
            cmd.Parameters.AddWithValue("@leadStatus", "");
            cmd.Parameters.AddWithValue("@leadRemark", "");
            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[0].Action;
            }


            con.Open();
            string         query = " select * from companyDetails ";
            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]["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]["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>";
                    }
                }
            }

            return(data);
        }
Beispiel #3
0
        public ActionResult InsertDistributorFormData(DistributorFormModel DFM)
        {
            // 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";
            }

            // 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
            string s  = "none";
            string s2 = "none";
            string s3 = "none";
            string s4 = "none";

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

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@condition", "insert");
            cmd.Parameters.AddWithValue("@companyName ", DFM.companyName);
            cmd.Parameters.AddWithValue("@ownerName", DFM.ownerName);
            cmd.Parameters.AddWithValue("@ownerMobileNo", DFM.ownerMobileNo);
            cmd.Parameters.AddWithValue("@Address1", DFM.Address1);
            cmd.Parameters.AddWithValue("@Address2", DFM.Address2);
            cmd.Parameters.AddWithValue("@City", DFM.citytext);
            cmd.Parameters.AddWithValue("@State", DFM.statetext);
            cmd.Parameters.AddWithValue("@Pin", DFM.Pin);
            cmd.Parameters.AddWithValue("@GST_NO", DFM.GST_NO);
            cmd.Parameters.AddWithValue("@Identity_Proof", DFM.Identity_Proof);
            cmd.Parameters.AddWithValue("@Identity_Proof_Value", DFM.Identity_Proof_Value);
            cmd.Parameters.AddWithValue("@Alt_Identity_Proof", DFM.Alt_Identity_Proof);
            cmd.Parameters.AddWithValue("@Alt_Identity_Proof_Value", DFM.Alt_Identity_Proof_Value);
            cmd.Parameters.AddWithValue("@contactPerson", DFM.contactPerson);
            cmd.Parameters.AddWithValue("@contactMobileNo", DFM.contactMobileNo);
            cmd.Parameters.AddWithValue("@contactMailId", DFM.contactMailId);
            cmd.Parameters.AddWithValue("@bankName", DFM.bankName);
            cmd.Parameters.AddWithValue("@Branch", DFM.Branch);
            cmd.Parameters.AddWithValue("@accountNumber", DFM.accountNumber);
            cmd.Parameters.AddWithValue("@IFSC_Code", DFM.IFSC_Code);
            cmd.Parameters.AddWithValue("@accountName", DFM.accountName);
            cmd.Parameters.AddWithValue("@Referred_By", DFM.Referred_By);
            cmd.Parameters.AddWithValue("@leadgeneratedBy", s);
            cmd.Parameters.AddWithValue("@leadconvertedBy", s2);
            cmd.Parameters.AddWithValue("@relationshipManager", DFM.relationshipManager);
            cmd.Parameters.AddWithValue("@leadStatus", s3);
            cmd.Parameters.AddWithValue("@leadRemark", s4);
            cmd.ExecuteNonQuery();
            con.Close();

            // get latest uid by userid filter
            string userid = "";

            con.Open();
            string         query2 = "select top 1 * from users order by uId desc";
            SqlDataAdapter da2    = new SqlDataAdapter(query2, con);
            DataTable      dt2    = new DataTable();

            da2.Fill(dt2);
            int newusers = 0;

            if (dt2.Rows.Count > 0)
            {
                userid = Convert.ToString(dt2.Rows[0]["userID"]);

                string         q1  = "select * from users where userID = '" + userid + "'  ";
                SqlDataAdapter qda = new SqlDataAdapter(q1, con);
                DataTable      qdt = new DataTable();
                qda.Fill(qdt);

                if (qdt.Rows.Count > 0)
                {
                    newusers             = Convert.ToInt32(qdt.Rows[0]["uId"]);
                    Session["filterUid"] = newusers;
                }
            }
            con.Close();


            //end



            // ASSIGN TYPE

            con.Open();
            string     query3 = "update  users set Type='DistributorAdmin' where uId = " + userid + "  ";
            SqlCommand cm     = new SqlCommand(query3, con);

            cm.ExecuteNonQuery();
            con.Close();



            //END



            // get latest inserted compid
            string         query5 = "select top 1 * from companyDetails order by compId desc";
            SqlDataAdapter da5    = new SqlDataAdapter(query5, con);
            DataTable      dt5    = new DataTable();

            da5.Fill(dt5);
            int compid = 0;

            if (dt5.Rows.Count > 0)
            {
                compid = Convert.ToInt32(dt5.Rows[0]["compId"]);
            }
            else
            {
                compid = 0;
            }
            //end



            ModelState.Clear();


            ViewBag.Message = "Verified";

            return(View("~/Views/AddDistributor/AddDistributorPageContent.cshtml"));
        }
Beispiel #4
0
        // GET: UpdateDistributor
        public ActionResult UpdateDistributorIndex(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();
            DistributorFormModel DFM = new DistributorFormModel();

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

            da.Fill(dt);
            con.Close();


            if (dt.Rows.Count > 0)
            {
                DFM.compId                   = NestId;
                DFM.companyName              = dt.Rows[0]["companyName"].ToString();
                DFM.ownerName                = dt.Rows[0]["ownerName"].ToString();
                DFM.ownerMobileNo            = dt.Rows[0]["ownerMobileNo"].ToString();
                DFM.Address1                 = dt.Rows[0]["Address1"].ToString();
                DFM.Address2                 = dt.Rows[0]["Address2"].ToString();
                DFM.City                     = dt.Rows[0]["City"].ToString();
                DFM.State                    = dt.Rows[0]["State"].ToString();
                DFM.Pin                      = dt.Rows[0]["Pin"].ToString();
                DFM.GST_NO                   = dt.Rows[0]["GST_NO"].ToString();
                DFM.Identity_Proof           = dt.Rows[0]["Identity_Proof"].ToString();
                DFM.Identity_Proof_Value     = dt.Rows[0]["Identity_Proof_Value"].ToString();
                DFM.Alt_Identity_Proof       = dt.Rows[0]["Alt_Identity_Proof"].ToString();
                DFM.Alt_Identity_Proof_Value = dt.Rows[0]["Alt_Identity_Proof_Value"].ToString();
                DFM.contactPerson            = dt.Rows[0]["contactPerson"].ToString();
                DFM.contactMobileNo          = dt.Rows[0]["contactMobileNo"].ToString();
                DFM.contactMailId            = dt.Rows[0]["contactMailId"].ToString();
                DFM.bankName                 = dt.Rows[0]["bankName"].ToString();
                DFM.Branch                   = dt.Rows[0]["Branch"].ToString();
                DFM.accountNumber            = dt.Rows[0]["accountNumber"].ToString();
                DFM.IFSC_Code                = dt.Rows[0]["IFSC_Code"].ToString();
                DFM.accountName              = dt.Rows[0]["accountName"].ToString();
                DFM.Referred_By              = dt.Rows[0]["Referred_By"].ToString();
                DFM.leadgeneratedBy          = dt.Rows[0]["leadgeneratedBy"].ToString();
                DFM.leadconvertedBy          = dt.Rows[0]["leadconvertedBy"].ToString();
                DFM.relationshipManager      = dt.Rows[0]["relationshipManager"].ToString();
                DFM.leadStatus               = dt.Rows[0]["leadStatus"].ToString();
                DFM.leadRemark               = dt.Rows[0]["leadRemark"].ToString();
            }


            return(View("~/Views/UpdateDistributor/UpdateDistributorPageContent.cshtml", DFM));
        }