예제 #1
0
        public void SetAuditTrailApplicationLogin(string personalNumber, string userName, string loginStatus)
        {
            SqlConnection conn = DatabaseSql.GetConnectionMaster();
            SqlCommand    cmd  = DatabaseSql.GetCommand();

            try
            {
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandText = @"bioumum.usp_Set_AuditTrailApplicationLogin";
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@pPERNR", SqlDbType.VarChar, 15).Value = personalNumber;
                cmd.Parameters.Add("@pUSRNM", SqlDbType.VarChar, 30).Value = userName;
                cmd.Parameters.Add("@pAPPCD", SqlDbType.VarChar, 5).Value  = ConfigurationManager.AppSettings["ApplicationCode"];
                cmd.Parameters.Add("@pAPPST", SqlDbType.VarChar, 51).Value = loginStatus;


                cmd.ExecuteNonQuery();
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }
예제 #2
0
        public static Boolean SignatureAuthentication(string username, string password)
        {
            SqlConnection conn   = DatabaseSql.GetConnectionMaster();
            SqlCommand    cmd    = DatabaseSql.GetCommand();
            Boolean       result = false;

            try
            {
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandText = @"bioumum.sp_AUTHENTICATION_SIGNATURE";
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@pUSRNM", SqlDbType.VarChar, 15).Value = username;
                cmd.Parameters.Add("@pPASWD", SqlDbType.VarChar, 50).Value = password;
                cmd.Parameters.Add("@pUSRDT", SqlDbType.VarChar, 50).Value = "K815";//HttpContext.Current.Session["biofarma_userid"];
                cmd.Parameters.Add("@pRESULT", SqlDbType.Bit).Direction    = ParameterDirection.Output;

                cmd.ExecuteNonQuery();
                result = Convert.ToBoolean(cmd.Parameters["@pRESULT"].Value);
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }

            return(result);
        }
예제 #3
0
        public User SingleSignOnUserAuthentication(string personalNumber, string hostname, string hostip)
        {
            SqlConnection conn = DatabaseSql.GetConnectionMaster();
            SqlCommand    cmd  = DatabaseSql.GetCommand();

            try
            {
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandText = "EXEC bioumum.sp_AUTHENTICATION_LOGIN_CTI @userNik, @applicationCode;";

                cmd.Parameters.Add("@userNik", SqlDbType.NVarChar, 100);
                cmd.Parameters["@userNik"].Direction = ParameterDirection.Input;

                cmd.Parameters.Add("@applicationCode", SqlDbType.NVarChar, 100);
                cmd.Parameters["@applicationCode"].Direction = ParameterDirection.Input;

                cmd.Parameters["@userNik"].Value         = personalNumber;
                cmd.Parameters["@applicationCode"].Value = ConfigurationManager.AppSettings["ApplicationCode"];

                SqlDataReader reader = DatabaseSql.GetDataReader(cmd);
                {
                    while (reader.Read())
                    {
                        string nik              = Convert.ToString(reader["userid"]);           // PERNR
                        string userName         = Convert.ToString(reader["username"]);         // CNAME
                        string posid            = Convert.ToString(reader["posid"]);            // POSID
                        string posName          = Convert.ToString(reader["posname"]);          // PRPOS
                        string unitCode         = Convert.ToString(reader["unitCode"]);         // COCTR
                        string unitName         = Convert.ToString(reader["unitname"]);         // PRORG
                        string roleId           = Convert.ToString(reader["roleid"]);           // ROLID
                        string roleName         = Convert.ToString(reader["rolename"]);         // ROLNM
                        string grade            = Convert.ToString(reader["grade"]);            // PSGRP
                        string email            = Convert.ToString(reader["usermail"]);
                        string organizationCode = Convert.ToString(reader["organizationcode"]); //ORGCD

                        _user = new User(nik, posid, userName, posName, unitCode, unitName, roleId, roleName, grade, hostname, hostip, email, organizationCode);
                    }
                }
            }
            catch (Exception ex)
            {
                IsError      = true;
                ErrorMessage = ex.Message;
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
            return(_user);
        }
예제 #4
0
        public List <Menu> GetMenuFromDb()
        {
            string roleId          = HttpContext.Current.Session["biofarma_roleid"].ToString();
            string applicationCode = ConfigurationManager.AppSettings["ApplicationCode"];

            SqlConnection conn = DatabaseSql.GetConnectionMaster();
            SqlCommand    cmd  = DatabaseSql.GetCommand();

            try
            {
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandText = "EXEC bioumum.sp_ROLE_MODUL_GET @appid, @roleid;";

                cmd.Parameters.AddWithValue("@roleid", roleId);
                cmd.Parameters.AddWithValue("@appid", applicationCode);

                //cmd.Parameters.Add("@roleid", SqlDbType.NVarChar, 30);
                //cmd.Parameters["@roleid"].Direction = ParameterDirection.Input;
                //cmd.Parameters["@roleid"].Value = "00";

                SqlDataReader reader = DatabaseSql.GetDataReader(cmd);
                while (reader.Read())
                {
                    Menu m = new Menu();
                    m.Id       = Convert.ToInt16(reader["MODID"]);
                    m.MenuName = Convert.ToString(reader["MODUL"]);
                    //m.NavUrl  = HttpContext.Current.Server.MapPath(Convert.ToString(reader["NVURL"])); //Converting server path (~) into computer physical path (H:\)
                    m.NavUrl    = VirtualPathUtility.ToAbsolute(Convert.ToString(reader["NVURL"])); //Converting server path (~) into URL path (localhost/Default.aspx)
                    m.IconClass = Convert.ToString(reader["ICONM"]);
                    //If the Parent ID [PARID] in database == Null, then it was first level Menu (root)
                    if (reader["PARID"] != DBNull.Value)
                    {
                        m.Parent    = new Menu();
                        m.Parent.Id = Convert.ToInt16(reader["PARID"]);
                    }
                    listMenu.Add(m);
                }
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
            return(listMenu);
        }