예제 #1
0
 private bool getUser(LogOnModel model)
 {
     using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
     {
         DataTable dt = ws.LogonTrakcare(model.UserName, model.Password);
         if (dt.Rows.Count >= 1)
         {
             Session["username"] = dt.Rows[0].Field <string>("USERID");
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
예제 #2
0
        private bool Login1(string strUsername, string strPassword)
        {
            Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls();
            DataTable dt = ws.LogonTrakcare(strUsername, strPassword);

            if (dt.Rows.Count > 0)
            {
                using (InhToDoListDataContext dbc = new InhToDoListDataContext())
                {
                    var objcurrentuser = (from t1 in dbc.mst_user_logins
                                          where t1.mul_user_login == strUsername
                                          select t1).FirstOrDefault();
                    if (objcurrentuser != null && (objcurrentuser.mul_user_login == "Admin" && strPassword == "nimd@"))
                    {
                        Constant.CurrentUserLogin = strUsername;
                        return(true);
                    }
                    else
                    {
                        Constant.CurrentUserLogin = "";
                        return(false);
                    }
                }
            }
            else
            {
                if (strUsername == "Admin" && strPassword == "nimd@")
                {
                    Constant.CurrentUserLogin = strUsername;
                    return(true);
                }
                else
                {
                    Constant.CurrentUserLogin = "";
                    return(false);
                }
            }
        }
예제 #3
0
        private bool Login1(string strUsername, string strPassword, ref string msgalert)
        {
            bool checkLoginAdmin = false;

            msgalert = "";
            //if (strUsername == "Admin" && strPassword == "nimd@")
            //{
            //    Constant.CurrentUserLogin = strUsername;
            //    Constant.CurrentUserLoginName = "Admin";
            //    return true;
            //}

            try
            {
                Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls();
                DataTable dt = ws.LogonTrakcare(strUsername, strPassword);
                if (dt.Rows.Count > 0)
                {
                    try
                    {
                        DataRow dr = dt.Rows[0];
                        Constant.CurrentUserLoginName = dr["SSUSR_Name"].ToString();
                    }
                    catch (Exception ex)
                    {
                    }

                    using (InhToDoListDataContext dbc = new InhToDoListDataContext())
                    {
                        var objcurrentuser = (from t1 in dbc.mst_user_logins
                                              where t1.mul_user_login.ToUpper() == strUsername.ToUpper()
                                              select t1).FirstOrDefault();
                        if (objcurrentuser != null)
                        {
                            if (objcurrentuser.mut_status == 'A')
                            {
                                Constant.CurrentUserLogin = objcurrentuser.mul_user_login;
                                if (Constant.CurrentUserLoginName == "")
                                {
                                    Constant.CurrentUserLoginName = objcurrentuser.mul_fname;
                                }
                                return(true);
                            }
                            else
                            {
                                Constant.CurrentUserLogin = "";
                                msgalert = "Your status inactive. Please contact admin active status. ";
                                return(false);
                            }
                        }
                        else
                        {
                            Constant.CurrentUserLogin = "";
                            return(false);
                        }
                    }
                }
                else
                {
                    checkLoginAdmin = true;
                }
            }
            catch
            {
                checkLoginAdmin = true;
            }


            if (checkLoginAdmin)
            {
                if (strUsername == "CLT" ||
                    strUsername == "CTC" ||
                    strUsername == "HPC" ||
                    strUsername == "ook" ||
                    strUsername == "yee" ||
                    strUsername == "MKT" ||
                    (strUsername == "Admin" && strPassword == "nimd@"))
                {
                    using (InhToDoListDataContext dbc = new InhToDoListDataContext())
                    {
                        var objcurrentuser = (from t1 in dbc.mst_user_logins
                                              where t1.mul_user_login == strUsername
                                              select t1).FirstOrDefault();
                        if (objcurrentuser != null)
                        {
                            if (objcurrentuser.mut_status == 'A')
                            {
                                Constant.CurrentUserLogin     = strUsername;
                                Constant.CurrentUserLoginName = objcurrentuser.mul_fname;
                                return(true);
                            }
                            else
                            {
                                Constant.CurrentUserLogin = "";
                                msgalert = "Your status inactive. Please contact admin active status.";
                                return(false);
                            }
                        }
                        else
                        {
                            Constant.CurrentUserLogin = "";
                            return(false);
                        }
                    }
                }
                else
                {
                    Constant.CurrentUserLogin = "";
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }