Beispiel #1
0
        public ActionResult Login(string user, string pwd)
        {
            string cntroller = string.Empty, action = string.Empty;

            try
            {
                Tbl_LoginMaster obj = new Tbl_LoginMaster();
                if (MVCHelper.CheckLogin(user.Trim(), pwd.Trim(), ref obj))
                {
                    if (Convert.ToBoolean(obj.IsClient))
                    {
                        action = "Userpage"; cntroller = "IP";
                    }
                    else
                    {
                        action = "Home"; cntroller = "IP";
                    }
                }
                else
                {
                    action = "Login"; cntroller = "Login";
                    TempData["invalidmsg"] = "Wrong Credential!!!.";
                }
                return(RedirectToAction(action, cntroller));
            }
            catch (Exception ex)
            {
                TempData["invalidmsg"] = "Somthing wrong!!!.";
                return(View());
            }
        }
Beispiel #2
0
        public static bool CheckLogin(string uname, string pwd, ref Tbl_LoginMaster obj)
        {
            bool check = false;

            using (GSTDB db = new GSTDB())
            {
                var user = db.Tbl_LoginMaster.Where(x => x.UserName.Equals(uname) && x.Password.Equals(pwd)).FirstOrDefault();
                if (user != null)
                {
                    check = true;
                    obj   = user;
                }
            }
            return(check);
        }
Beispiel #3
0
        public static void SaveUser(Tbl_ClientMaster obj, HttpPostedFileBase doc)
        {
            string filepath = System.Configuration.ConfigurationManager.AppSettings["SaveFilePath"];

            using (GSTDB db = new GSTDB())
            {
                obj.DOJ = DateTime.Now;
                db.Tbl_ClientMaster.Add(obj);
                db.SaveChanges();
                if (doc != null && doc.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(doc.FileName);
                    doc.SaveAs(Path.Combine(filepath, DateTime.Now.ToString("ddMMyyyy_" + obj.ClientID + ".jpg")));
                }
                Tbl_LoginMaster loginObj = new Tbl_LoginMaster();
                loginObj.Email     = obj.Mail1;
                loginObj.UserName  = (string.IsNullOrEmpty(obj.Mail1) ? obj.Mob1 : obj.Mail1);
                loginObj.Password  = "******";
                loginObj.IsClient  = true;
                loginObj.CilientID = obj.ClientID;
                db.Tbl_LoginMaster.Add(loginObj);
                db.SaveChanges();
            }
        }