Example #1
0
        public ActionResult Index(AdminLogin a)
        {
            Property p  = new Property();
            DataSet  ds = new DataSet();

            //byte[] e = ASCIIEncoding.ASCII.GetBytes(a.Email);
            //string EncryptedEmail = Convert.ToBase64String(e);

            //byte[] b = ASCIIEncoding.ASCII.GetBytes(a.Password);
            //string EncryptedPassword = Convert.ToBase64String(b);

            p.Condition1 = enc.Encrypt(a.Email);
            p.Condition2 = enc.Encrypt(a.Password);
            p.OnTable    = "FetchAdminLoginUser";
            ds           = dl.FetchAdminLogin(p);
            try
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    HttpCookie rxgoAdminCookie = Request.Cookies["rxgoAdmin"];
                    String     Type            = ds.Tables[0].Rows[0]["UserType"].ToString();
                    String     Status          = ds.Tables[0].Rows[0]["IsActive"].ToString();

                    if (Type == "ADMIN" && Status == "True")
                    {
                        rxgoAdminCookie          = new HttpCookie("rxgoAdmin");
                        rxgoAdminCookie["Hid"]   = ds.Tables[0].Rows[0]["HospitalId"].ToString();
                        rxgoAdminCookie["Utyp"]  = ds.Tables[0].Rows[0]["UserType"].ToString();
                        rxgoAdminCookie["UName"] = ds.Tables[0].Rows[0]["HospitalName"].ToString();
                        rxgoAdminCookie.Expires  = DateTime.Now.AddDays(1);
                        Response.Cookies.Add(rxgoAdminCookie);
                        return(RedirectToAction("Index", "Admin"));
                    }


                    else
                    {
                        TempData["MSGlogin"] = "******";
                    }
                }
                else
                {
                    TempData["MSGlogin"] = "******";
                }
            }
            catch (Exception ex)
            {
                TempData["MSGlogin"] = "******";
            }

            TempData["MSG"] = "Email-id / Password is incorrect or account not active!";

            return(RedirectToAction("Index", "AdminLogin"));
        }
Example #2
0
        //public JsonResult DeleteExecutive(string id)
        //{
        //    Property a = new Property();
        //    DataSet ds = new DataSet();
        //    a.Condition1 = id;
        //    a.OnTable = "DeleteExecutive";
        //    ds = dl.FetchMarketingExecutive_sp(a);
        //    return Json(1, JsonRequestBehavior.AllowGet);
        //}
        public ActionResult MyProfile(string id)
        {
            List <AdminLogin> AdminLogin = new List <AdminLogin>();
            Property          p          = new Property();
            DataSet           ds         = new DataSet();

            p.OnTable = "FetchAdmin";

            p.Condition1 = id;

            ds = dl.FetchAdminLogin(p);

            List <SelectListItem> CountryList = new List <SelectListItem>();

            CountryList.Add(new SelectListItem {
                Text = "Select Country", Value = ""
            });
            foreach (DataRow dr in ds.Tables[1].Rows)
            {
                CountryList.Add(new SelectListItem {
                    Text = dr["CountryName"].ToString(), Value = dr["CountryId"].ToString()
                });
            }
            ViewBag.CountryList = new SelectList(CountryList, "Value", "Text");

            AdminLogin info = new RXGOADMIN.Models.AdminLogin();

            try
            {
                info = new RXGOADMIN.Models.AdminLogin()
                {
                    HospitalId         = ds.Tables[0].Rows[0]["HospitalId"].ToString(),
                    Email              = enc.Decrypt(ds.Tables[0].Rows[0]["Email"].ToString()),
                    Password           = enc.Decrypt(ds.Tables[0].Rows[0]["Password"].ToString()),
                    Address            = ds.Tables[0].Rows[0]["Address"].ToString(),
                    Phone              = ds.Tables[0].Rows[0]["Phone"].ToString(),
                    HospitalName       = ds.Tables[0].Rows[0]["HospitalName"].ToString(),
                    HospitalWebsiteUrl = ds.Tables[0].Rows[0]["HospitalWebsiteUrl"].ToString(),
                    CountryId          = ds.Tables[0].Rows[0]["CountryId"].ToString(),
                    CountryName        = ds.Tables[0].Rows[0]["CountryName"].ToString(),
                    StateId            = ds.Tables[0].Rows[0]["StateId"].ToString(),
                    StateName          = ds.Tables[0].Rows[0]["StateName"].ToString(),
                    CityId             = ds.Tables[0].Rows[0]["CityId"].ToString(),
                    CityName           = ds.Tables[0].Rows[0]["CityName"].ToString()
                };
            }
            catch (Exception ex)
            {
            }

            return(View(info));
        }