Ejemplo n.º 1
0
        public ActionResult Login(string UserName, string Password)
        {
            if (ModelState.IsValid)
            {
                int     HospitalId;
                DataSet ds = new DataSet();
                try
                {
                    string strConfigFileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.ToString()) + "\\Information.xml";
                    ds.ReadXml(strConfigFileName);
                    HospitalId = Convert.ToInt32(ds.Tables[0].Rows[0]["HospitalId"].ToString());

                    WebServiceClient ws     = new WebServiceClient();
                    bool             result = ws.ControlHospitalUser(HospitalId, UserName, Password);
                    if (result)
                    {
                        Session["user"] = UserName;
                        return(RedirectToAction("Index", "Home"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Kullanıcı adı veya şifre hatalı!");
                    }
                }
                catch (Exception exc)
                {
                    throw exc;
                }
            }
            return(View());
        }