Esempio n. 1
0
        public LoginUser LoginInformation(string username, string password)
        {
            LoginUser entity = new LoginUser();

            try
            {
                using (SqlConnection con = DBConnectionISMS.GetConnection())
                {
                    using (SqlCommand cmd = new SqlCommand("Usp_Isms_Login", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@Username", username);
                        cmd.Parameters.AddWithValue("@Password", password);
                        cmd.Parameters.AddWithValue("@status", 0);
                        dr = cmd.ExecuteReader();
                        //cmd.ExecuteNonQuery();
                        //int retval = (int)cmd.Parameters["@status"].Value;

                        if (dr.Read())
                        {
                            entity.EmpName  = dr["Emp_Name"].ToString();
                            entity.EmpID    = dr["Emp_ID"].ToString();
                            entity.RoleID   = Convert.ToInt32(dr["RollID"]);
                            entity.RoleName = dr["Roll_Name"].ToString();
                        }
                    }
                }
                return(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public LoginUser InsertLoginDetails(LoginUser entity)
        {
            int insert;

            try
            {
                using (SqlConnection con = DBConnectionISMS.GetConnection())
                {
                    using (SqlCommand cmd = new SqlCommand("Usp_LoginDetails", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@EmpID", entity.EmpID);

                        cmd.Parameters.AddWithValue("@LastLoginTime", entity.LastLogin);

                        insert = cmd.ExecuteNonQuery();
                        if (insert == 1)
                        {
                        }
                        else
                        {
                        }
                    }
                }
                return(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public List<Department> LoadDepartment(int RoleId)
        {
            try
            {


                connection = new DBConnectionISMS();
                SqlCommand command = new SqlCommand();
                command.CommandText = "USPGetDepartment";
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@RoleId", RoleId);
                DataTable tblDepartment = connection.GetRecord(command);
                List<Department> departments = new List<Department>();
                departments = (from department in tblDepartment.AsEnumerable()
                               select new Department
                               {
                                   Id = department.Field<int>("ID"),
                                   Name = department.Field<string>("Name")
                               }).ToList<Department>();
                return departments;
            }
            catch (Exception)
            {

                throw;
            }

        }
Esempio n. 4
0
 public int UploadTemplate(SqlCommand command)
 {
     try
     {
         connection = new DBConnectionISMS();
         return(connection.ExecuteQuery(command));
     }
     catch (Exception)
     {
         throw;
     }
 }