示例#1
0
        public static ColorProfile FromMemory(byte[] buffer)
        {
            if (buffer == null)
            {
                throw new ArgumentException(nameof(buffer));
            }

            using (var mem = new ComMemory(buffer))
            {
                var prof = new PROFILE();
                prof.dwType       = PROFILE_MEMBUFFER;
                prof.pProfileData = mem.Pointer;
                prof.cbDataSize   = mem.Size;
                var handle = OpenColorProfile(ref prof, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING);
                if (handle == IntPtr.Zero)
                {
                    throw new Win32Exception(Marshal.GetLastWin32Error());
                }

                try
                {
                    return(new ColorProfile(handle));
                }
                finally
                {
                    CloseColorProfile(handle);
                }
            }
        }
 public ActionResult ValidateUpdate(String first_name, String last_name, String sex, String avatar, String birthday, String email, String phone, String idcard, String address, String decsription)
 {
     if (HttpContext.Session["userID"] == null)
     {
         TempData["Message"] = "Vui lòng đăng nhập tài khoản ";
         return(RedirectToAction("DangNhap", "FrontEnd"));
     }
     else
     {
         int     userID     = Convert.ToInt32(HttpContext.Session["userID"]);
         PROFILE getProfile = db.PROFILEs.Find(userID);
         getProfile.ADDRESS         = address;
         getProfile.SEX             = sex;
         getProfile.IDENTITY_CARD   = idcard;
         getProfile.LAST_NAME       = last_name;
         getProfile.FIRST_NAME      = first_name;
         getProfile.AVATAR          = avatar;
         getProfile.BIRTHDAY        = birthday;
         getProfile.EMAIL           = email;
         getProfile.PHONE           = Convert.ToInt32(phone);
         getProfile.DESCRIPTION     = decsription;
         db.Entry(getProfile).State = EntityState.Modified;
         db.SaveChanges();
         TempData["Message"] = "Cập nhập thành công hồ sơ";
         return(RedirectToAction("Profile", "CV"));
     }
 }
示例#3
0
        public static int GetColorProfileChannelCount(Stream colorProfileStream)
        {
            int    result = 0;
            IntPtr intPtr = IntPtr.Zero;

            byte[]   array      = new byte[colorProfileStream.Length];
            int      cbDataSize = colorProfileStream.Read(array, 0, array.Length);
            GCHandle gchandle   = GCHandle.Alloc(array, GCHandleType.Pinned);

            try
            {
                PROFILE profile = default;
                profile.dwType       = 2u;
                profile.pProfileData = gchandle.AddrOfPinnedObject();
                profile.cbDataSize   = (uint)cbDataSize;
                intPtr = OpenColorProfile(ref profile, 1u, 1u, 3u);
                if (intPtr != IntPtr.Zero)
                {
                    if (GetColorProfileHeader(intPtr, out PROFILEHEADER profileheader))
                    {
                        result = ColorSpaceToChannelCount(profileheader.phDataColorSpace);
                    }
                }
            }
            finally
            {
                if (intPtr != IntPtr.Zero)
                {
                    CloseColorProfile(intPtr);
                }
                gchandle.Free();
            }
            return(result);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            PROFILE pROFILE = db.PROFILEs.Find(id);

            db.PROFILEs.Remove(pROFILE);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#5
0
        public async Task DeletePerfil(int?PerfilID)
        {
            PROFILE Perfil = await _context.PROFILE.FindAsync(PerfilID);

            Perfil.idState = 2;
            _context.Update(Perfil);
            await Save();
        }
示例#6
0
    void loginWindow(int id)
    {
        GUI.Label(new Rect(10, 20, 100, 30), "User Name");
        username = GUI.TextField(new Rect(10, 40, 180, 30), username);
        GUI.Label(new Rect(10, 90, 100, 30), "Password");
        password = GUI.PasswordField(new Rect(10, 110, 180, 30), password, '*');
        if (GUI.Button(new Rect(10, 150, 80, 30), "Cancel"))
        {
            isLogin = false;
        }
        if (GUI.Button(new Rect(100, 150, 80, 30), "Login"))
        {
            int connect_result = EmotivCloudClient.EC_Connect();
            if (connect_result == EmotivCloudClient.EC_OK)
            {
                var login_result = EmotivCloudClient.EC_Login(username, password);
                if (login_result == EmotivCloudClient.EC_OK)
                {
                    Debug.Log("login success");
                    EmotivCloudClient.EC_GetUserDetail(ref userCloudId);
                    Debug.Log("user cloud id: " + userCloudId.ToString());
                    nProfile = EmotivCloudClient.EC_GetAllProfileName(userCloudId);
                    Debug.Log("number profiles: " + nProfile.ToString());
                    profiles = new List <PROFILE>();
                    for (var i = 0; i < nProfile; i++)
                    {
                        //Debug.Log("delete profile: ");
                        //var _id = EmotivCloudClient.EC_ProfileIDAtIndex(userCloudId, i);
                        //EmotivCloudClient.EC_DeleteUserProfile(userCloudId, _id);

                        int ii = EmotivCloudClient.EC_ProfileIDAtIndex(userCloudId, i);
                        EmotivCloudClient.Plugin_EC_ProfileNameAtIndex(userCloudId, 0);
                        PROFILE t = new PROFILE();
                        t.id   = EmotivCloudClient.EC_ProfileIDAtIndex(userCloudId, i);
                        t.name = EmotivCloudClient.Plugin_EC_ProfileNameAtIndex(userCloudId, i);
                        profiles.Add(t);
                        Debug.Log("profile name: " + profiles[i].name + " profile id: " + profiles[i].id.ToString());
                    }
                    isLogin = false;
                }

                else
                {
                    Debug.Log("cannot login, error: " + login_result.ToString());
                }
            }
            else
            {
                Debug.Log("cannot connect to emotiv cloud, error: " + connect_result.ToString());
            }
        }
        if (userCloudId != -1) //logged in
        {
            if (GUI.Button(new Rect(10, 150, 80, 30), "Load Profile"))
            {
            }
        }
    }
示例#7
0
        public ActionResult DeleteConfirmed()
        {
            var     id      = User.Identity.GetUserId();
            PROFILE Profile = db.PROFILES.Find(id);

            db.PROFILES.Remove(Profile);
            db.SaveChanges();

            return(RedirectToAction("DeleteUser", "Account", new { id }));
        }
 //de em check ben em xai gi
 public PROFILE layProfileTuUserID(int userID)
 {
     using (var DBEntities = new PartTimeJobEntitiesEntities())
     {
         PROFILE getProfile = (from profile in DBEntities.PROFILEs
                               where profile.PROFILE_ID == userID
                               select profile).FirstOrDefault <PROFILE>();
         return(getProfile);
     }
 }
示例#9
0
文件: mscms.cs 项目: clowd/bmplib
    public static unsafe SafeProfileHandle OpenProfile(void *pProfileData, uint pLength)
    {
        var profile = new PROFILE
        {
            dwType       = ProfileType.PROFILE_MEMBUFFER,
            pProfileData = pProfileData,
            cbDataSize   = pLength,
        };

        return(OpenColorProfile(ref profile, 1, 1, 3 /*OPEN_EXISTING*/));
    }
 public ActionResult Edit([Bind(Include = "PROFILE_ID,FIRST_NAME,LAST_NAME,IDENTITY_CARD,BIRTHDAY,SEX,EMAIL,PHONE,TOWN_ID,ADDRESS,AVATAR,DESCRIPTION")] PROFILE pROFILE)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pROFILE).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TOWN_ID = new SelectList(db.TOWNs, "TOWN_ID", "TOWN_NAME", pROFILE.TOWN_ID);
     return(View(pROFILE));
 }
示例#11
0
        public static ColorProfile FromFileName(string fileName, string machineName = null)
        {
            if (fileName == null)
            {
                throw new ArgumentException(nameof(fileName));
            }

            string path;

            if (fileName.IndexOfAny(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }) < 0)
            {
                path = Path.Combine(GetColorDirectoryPath(machineName), fileName);
            }
            else
            {
                if (machineName != null)
                {
                    throw new ArgumentException(null, nameof(machineName));
                }

                path = Path.GetFullPath(fileName);
            }

            var name = Path.GetFileName(path);

            // note this is ANSI only
            var ptr = Marshal.StringToCoTaskMemAnsi(name);

            try
            {
                var prof = new PROFILE();
                prof.dwType       = PROFILE_FILENAME;
                prof.pProfileData = ptr;
                prof.cbDataSize   = name.Length + 1;
                var handle = OpenColorProfile(ref prof, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING);
                if (handle == IntPtr.Zero)
                {
                    throw new Win32Exception(Marshal.GetLastWin32Error());
                }

                try
                {
                    return(new ColorProfile(handle, path));
                }
                finally
                {
                    CloseColorProfile(handle);
                }
            }
            finally
            {
                Marshal.FreeCoTaskMem(ptr);
            }
        }
示例#12
0
        public ActionResult Create([Bind(Include = "userid,firstname,lastname,email,discipline,contactnumber,skills,units,interests,bio")] PROFILE Profile)
        {
            if (ModelState.IsValid)
            {
                Profile.userid = User.Identity.GetUserId();
                db.PROFILES.Add(Profile);
                db.SaveChanges();

                return(RedirectToAction("Index", "Home"));
            }

            return(RedirectToAction("Index", "Manage"));
        }
示例#13
0
        public async Task <string> InsertPerfil(PROFILE perfil)
        {
            try
            {
                await _context.AddAsync(perfil);
                await Save();

                return("Perfil Ingresado Exitosamente");
            }
            catch (Exception)
            {
                return("Error en el ingreso de perfil");
            }
        }
        // GET: CV/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PROFILE pROFILE = db.PROFILEs.Find(id);

            if (pROFILE == null)
            {
                return(HttpNotFound());
            }
            return(View(pROFILE));
        }
示例#15
0
        internal DeviceAndParametersWithProfile FitInternal()
        {
            if (Profile == null)
            {
                Profile = new PROFILE
                {
                    PROF_NAME = "DEFAULT"
                }
            }
            ;

            return(this);
        }
    }
 public ActionResult Update()
 {
     if (HttpContext.Session["userID"] == null)
     {
         TempData["Message"] = "Vui lòng đăng nhập tài khoản ";
         return(RedirectToAction("DangNhap", "FrontEnd"));
     }
     else
     {
         int     userID     = Convert.ToInt32(HttpContext.Session["userID"]);
         PROFILE getProfile = (from profile in db.PROFILEs where profile.PROFILE_ID == userID select profile).SingleOrDefault();
         return(View(getProfile));
     }
 }
示例#17
0
        public async Task <string> UpdatePerfil(PROFILE perfil)
        {
            try
            {
                _context.Update(perfil);
                await Save();

                return("Perfil Actualizdo Exitosamente");
            }
            catch (Exception)
            {
                return("Error en el actualizacion de perfil");
            }
        }
示例#18
0
        // GET: Profiles/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Manage"));
            }
            PROFILE Profile = db.PROFILES.Find(id);

            if (Profile == null)
            {
                return(RedirectToAction("Index", "Manage"));
            }
            return(View(Profile));
        }
        // GET: CV/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PROFILE pROFILE = db.PROFILEs.Find(id);

            if (pROFILE == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TOWN_ID = new SelectList(db.TOWNs, "TOWN_ID", "TOWN_NAME", pROFILE.TOWN_ID);
            return(View(pROFILE));
        }
示例#20
0
        // GET: Profiles/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Manage"));
                //new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            PROFILE Profile = db.PROFILES.Find(id);

            if (Profile == null || Profile.userid != User.Identity.GetUserId())
            {
                return(RedirectToAction("Index", "Manage"));
            }
            return(View(Profile));
        }
示例#21
0
        // GET: Profiles/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                id = User.Identity.GetUserId();
                if (id == null)
                {
                    return(RedirectToAction("Index", "Manage"));
                }
            }

            PROFILE Profile = db.PROFILES.Find(id);

            return(View(Profile));
        }
示例#22
0
 public ActionResult Edit([Bind(Include = "userid,firstname,lastname,email,discipline,contactnumber,skills,units,interests,bio")] PROFILE Profile)
 {
     if (Profile.userid != User.Identity.GetUserId())
     {
         return(RedirectToAction("Index", "Manage"));
     }
     if (ModelState.IsValid)
     {
         Profile.email           = User.Identity.GetUserName();
         db.Entry(Profile).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Manage"));
     }
     return(View(Profile));
 }
        public bool dangKyUserFacebook(string facebookID, Dictionary <string, string> fbInfo)
        {
            using (var DBEntities = new PartTimeJobEntitiesEntities())
            {
                using (var DBTransactions = DBEntities.Database.BeginTransaction())
                {
                    try
                    {
                        USER newUser    = new USER();
                        var  generateID = (from user in DBEntities.USERs
                                           orderby user.USER_ID descending
                                           select user.USER_ID).Take(1).SingleOrDefault();

                        newUser.FACEBOOK_ID   = facebookID;
                        newUser.USERNAME      = facebookID + (generateID + 1);
                        newUser.PASSWORD      = facebookID + "2019group21dotnetNLUHashing";
                        newUser.PASSWORDAGAIN = facebookID + "2019group21dotnetNLUHashing";
                        DateTime dateTime = DateTime.UtcNow.Date;
                        newUser.JOINED_DATE = dateTime.ToString("MM/dd/yyyy");
                        newUser.GMAIL_ID    = Convert.ToString(generateID + 1);
                        newUser.USER_STATUS = (byte)1;
                        newUser.ROLE_ID     = byte.Parse(fbInfo["roleID"]);
                        DBEntities.USERs.Add(newUser);

                        // tao xong user , tien hanh tao profile
                        PROFILE newProfile = new PROFILE();
                        newProfile.FIRST_NAME = fbInfo["fbFirstName"];
                        newProfile.LAST_NAME  = fbInfo["fbLastName"];
                        newProfile.ADDRESS    = fbInfo["fbHometown"];
                        newProfile.BIRTHDAY   = fbInfo["fbBirthday"];
                        newProfile.EMAIL      = fbInfo["fbEmail"];
                        newProfile.SEX        = fbInfo["fbGender"];
                        DBEntities.PROFILEs.Add(newProfile);
                        DBEntities.SaveChanges();
                        DBTransactions.Commit();
                        return(true);
                    }
                    catch (Exception)
                    {
                        DBTransactions.Rollback();
                        DBEntities.Database.ExecuteSqlCommand("USE PartTimeJob;DECLARE @lastIdent int;SET @lastIdent = (SELECT TOP 1 USER_ID FROM[USER] ORDER BY USER_ID DESC);IF @lastIdent IS NULL BEGIN SET @lastIdent=1;END;DBCC CHECKIDENT('dbo.USER',RESEED,@lastIdent);");
                        DBEntities.Database.ExecuteSqlCommand("USE PartTimeJob;DECLARE @lastIdent int;SET @lastIdent = (SELECT TOP 1 PROFILE_ID FROM[PROFILE] ORDER BY PROFILE_ID DESC);IF @lastIdent IS NULL BEGIN SET @lastIdent=1;END;DBCC CHECKIDENT('dbo.PROFILE',RESEED,@lastIdent);");
                        return(false);
                    }
                }
            }
        }
示例#24
0
        //Thêm khách hàng đồng thời tạo tài khoản khách hàng ID: Số đt KH, Pass : CMND (Mặc định)
        public int InsertCustomer(string pID, string pLastName, string pFirstName, string pSex, string pPhone, string pAddress, int pTypeCus)
        {
            //B1 thêm tài khoản cho khách hàng
            //Username: Số đt khách hàng, Password: CMND khách hàng
            if (acc.IsAccount(pPhone) != 0)
            {
                return(1);//Tồn tại tài khoản
            }
            else
            {
                int idUser = acc.InsertAccount(pPhone, pID);//thêm thành công sẽ trả về ID_USER vừa thêm
                if (idUser != 0)
                {
                    DC_CustomerDataContext cus = new DC_CustomerDataContext();

                    PROFILE          profile = new PROFILE();
                    PROFILE_CUSTOMER pro_cus = new PROFILE_CUSTOMER();

                    int number = GetIDMaxProFile() + 1;

                    profile.ID_PROFILE     = number;
                    profile.ID_USER        = idUser;
                    profile.IDENFITICATION = pID;
                    profile.LAST_NAME      = pLastName;
                    profile.FIRST_NAME     = pFirstName;
                    profile.SEX            = pSex;
                    profile.PHONE          = pPhone;
                    profile.ADDRESS        = pAddress;
                    profile.STATUS         = 1;

                    pro_cus.ID_PROFILE_CUSTOMER = GetIDMaxProFileTypeCus() + 1;
                    pro_cus.ID_PROFILE          = number;
                    pro_cus.ID_TYPE_CUS         = pTypeCus;
                    pro_cus.SCORE = 0;

                    cus.PROFILEs.InsertOnSubmit(profile);
                    cus.PROFILE_CUSTOMERs.InsertOnSubmit(pro_cus);
                    cus.SubmitChanges();
                    return(2);//Thêm thành công
                }
                else
                {
                    return(3);//thêm thất bại
                }
            }
        }
示例#25
0
        //
        // GET: /Manage/Index
        public async Task <ActionResult> Index(ManageMessageId?message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var     userID  = User.Identity.GetUserId();
            PROFILE Profile = db.PROFILES.Find(userID);

            if (userID == null || Profile == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var model = new IndexViewModel
            {
                HasPassword = HasPassword(),
                //PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
                //TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userID),
                Logins            = await UserManager.GetLoginsAsync(userID),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userID),

                userid        = userID,
                firstname     = Profile.firstname,
                lastname      = Profile.lastname,
                email         = Profile.email,
                discipline    = Profile.discipline,
                contactnumber = Profile.contactnumber,
                skills        = Profile.skills,
                units         = Profile.units,
                interests     = Profile.interests,
                bio           = Profile.bio
            };

            foreach (EXPERIENCE exp in db.EXPERIENCEs.Include(e => e.PROFILE))
            {
            }
            TempData["experiences"] = "a";
            return(View(model));
        }
示例#26
0
        public ActionResult Create([Bind(Include = "USERNAME,PASSWORD,ROLE_ID,FACEBOOK_ID,GMAIL_ID,RESET_TOKEN")] USER uSER)
        {
            uSER.USER_STATUS = 1;

            DateTime dateTime = DateTime.UtcNow.Date;

            uSER.JOINED_DATE   = dateTime.ToString("MM/dd/yyyy");
            uSER.PASSWORDAGAIN = uSER.PASSWORD;


            var generateID = (from user in db.USERs
                              orderby user.USER_ID descending
                              select user.USER_ID).Take(1).SingleOrDefault();

            if (uSER.FACEBOOK_ID == null)
            {
                uSER.FACEBOOK_ID = Convert.ToString(generateID + 1);
            }
            if (uSER.GMAIL_ID == null)
            {
                uSER.GMAIL_ID = Convert.ToString(generateID + 1);
            }

            PROFILE newProfile = new PROFILE();

            db.PROFILEs.Add(newProfile);
            try
            {
                db.USERs.Add(uSER);
                db.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                foreach (var errors in ex.EntityValidationErrors)
                {
                    foreach (var validationError in errors.ValidationErrors)
                    {
                        // get the error message
                        string errorMessage = validationError.ErrorMessage;
                        Debug.WriteLine(errorMessage);
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
示例#27
0
    void UploadProfileWindow(int wId)
    {
        GUI.Label(new Rect(10, 20, 200, 30), "Create new profile");
        newProfileName = GUI.TextField(new Rect(10, 40, 180, 30), newProfileName);
        if (GUI.Button(new Rect(10, 80, 90, 30), "Cancel"))
        {
            isUploadProfile = false;
        }
        if (GUI.Button(new Rect(120, 80, 80, 30), "Upload"))
        {
            int pid = EmotivCloudClient.EC_GetProfileId(userCloudId, newProfileName);
            if (pid >= 0)
            {
                EmotivCloudClient.EC_UpdateUserProfile(userCloudId, EmoUserManagement.currentUser, pid);
                //close upload window
                isUploadProfile = false;
            }
            else
            {
                EmotivCloudClient.EC_SaveUserProfile(userCloudId, EmoUserManagement.currentUser, newProfileName, EmotivCloudClient.profileFileType.TRAINING);
                int     id = EmotivCloudClient.EC_GetProfileId(userCloudId, newProfileName);
                PROFILE t  = new PROFILE();
                t.id   = id;
                t.name = newProfileName;
                profiles.Add(t);
                //close upload window
                isUploadProfile = false;
            }
        }
        GUI.Label(new Rect(10, 110, 200, 30), "or select from your profiles");
        vec2_Scoll = GUI.BeginScrollView(new Rect(10, 130, 200, 300), vec2_Scoll, new Rect(0, 0, 200, 300));
        int _i = 0;

        foreach (PROFILE p in profiles)
        {
            if (GUI.Button(new Rect(0, 10 + _i * 35, 200, 30), p.name))
            {
                newProfileName = p.name;
            }
            _i++;
        }
        GUI.EndScrollView();
    }
示例#28
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    PROFILE Profile = new PROFILE();
                    Profile.userid     = User.Identity.GetUserId();
                    Profile.firstname  = model.Givenname;
                    Profile.lastname   = model.Surname;
                    Profile.discipline = model.Discipline;
                    Profile.email      = model.Email;

                    Session["fname"]    = Profile.firstname;
                    TempData["profile"] = Profile;
                    return(RedirectToAction("Create", "Profiles"));
                }
                AddErrors(result);
            }


            // If we got this far, something failed, redisplay form
            return(View(model));
        }
示例#29
0
文件: mscms.cs 项目: clowd/bmplib
 private static extern SafeProfileHandle OpenColorProfile(ref PROFILE pProfile, uint dwDesiredAccess, uint dwShareMode, uint dwCreationMode);
示例#30
0
    // OnGUI is called for rendering and handling GUI events.
    void OnGUI()
    {
        // Draw Option Button on the right middle.
        Rect optionButtonRect = new Rect (Screen.width - optionButtonWidth, (Screen.height - optionButtonHeight) / 2 + optionButtonHeight, optionButtonWidth, optionButtonHeight);
        if (GUI.Button(optionButtonRect, "CS Option Menu")) {
            isMenuPopUp = !isMenuPopUp;
        }

        if (!isMenuPopUp) {
            return;
        } else {
            Rect menuRect = new Rect((Screen.width - menuWidth) * 0.5f,
                                    (Screen.height - menuHeight) * 0.5f,
                                    menuWidth,
                                    menuHeight);

            GUILayout.BeginArea(menuRect);
                // Whether DS is available.
                if (MenuButton(strDLBAvail)) {
                    bool bAvail = isAvailable();

                    bShowWindow = true;
                    logText = strDLBAvail + "\n [Return]: " + bAvail;
                    LOGI(logText);
                }

                // Whether DS has been initialized.
                if (MenuButton(strDLBInit)) {
                    int ret = initialize();

                    bShowWindow = true;
                    logText = strDLBInit + "\n [Return]: " + ret;
                    LOGI(logText);
                }

                // Set DS profile
                if (MenuButton(strSetPro)) {

                    switch(curProfile){
                    case PROFILE.MOVIE:
                    case PROFILE.MUSIC:
                    case PROFILE.GAME:
                    case PROFILE.VOICE:
                        break;
                    default:
                        curProfile = PROFILE.MOVIE;
                        break;
                    }

                    int ret = setProfile((int)curProfile);
                    bShowWindow = true;
                    profileName = curProfile.ToString();
                    logText = strSetPro + "\n[Index]: " + (int)curProfile + " (" + profileName + ")" + "\n[Return]: " + ret;
                    LOGI(logText);

                    curProfile = curProfile + 1;

                }

                // Pause DS.
                // Only for testing here. Maybe, it should implemented in "OnApplicationPause()" function.
                if (MenuButton(strPauseDS)) {
                    int ret = suspendSession();

                    bShowWindow = true;
                    logText = strPauseDS + "\n [Return]: " + ret;
                    LOGI(logText);
                }

                // Restore DS.
                // Only for testing here. Maybe, it should implemented in "OnApplicationFocus()" function.
                if (MenuButton(strRestoreDS)) {
                    int ret = restartSession();

                    bShowWindow = true;
                    logText = strRestoreDS + "\n [Return]: " + ret;
                    LOGI(logText);
                }

                // Release DS.
                // Only for testing here. Maybe, it should implemented in "OnApplicationQuit()" function.
                if (MenuButton(strReleaseDS)) {
                    release();

                    bShowWindow = true;
                    logText = strReleaseDS;
                    LOGI(logText);
                }
            GUILayout.EndArea();

            // Used for printing log on UI.
            if (bShowWindow) {
                showLogWindow();
            }
        }
    }
        public ActionResult XacThucDangKy(USER model)
        {
            {
                if (!ModelState.IsValid)
                {
                    ViewBag.PreviousPage       = "Trang Chủ";
                    ViewBag.PreviousAction     = "TrangChu";
                    ViewBag.PreviousController = "FrontEnd";
                    using (var DBEntities = new PartTimeJobEntitiesEntities())
                    {
                        List <ROLE> roleList = (from role in DBEntities.ROLEs
                                                where role.ROLE_ID == 2 || role.ROLE_ID == 3
                                                select role).ToList();
                        SelectList resultList = new SelectList(roleList, "ROLE_ID", "ROLE_NAME");
                        ViewBag.RoleList = resultList;
                        return(View("DangKy", model));
                    }
                }
                else
                {
                    using (var DBEntities = new PartTimeJobEntitiesEntities())
                    {
                        using (var DBTransactions = DBEntities.Database.BeginTransaction())
                        {
                            USER getUser = (from user in DBEntities.USERs
                                            where user.USERNAME == model.USERNAME
                                            select user).FirstOrDefault <USER>();
                            if (getUser != null)
                            {
                                ViewBag.PreviousPage       = "Trang Chủ";
                                ViewBag.PreviousAction     = "TrangChu";
                                ViewBag.PreviousController = "FrontEnd";
                                List <ROLE> roleList = (from role in DBEntities.ROLEs
                                                        where role.ROLE_ID == 2 || role.ROLE_ID == 3
                                                        select role).ToList();
                                SelectList resultList = new SelectList(roleList, "ROLE_ID", "ROLE_NAME");
                                ViewBag.RoleList      = resultList;
                                ViewBag.UsernameError = "Tài khoản này đã có người sử dụng";
                                return(View("DangKy", model));
                            }
                            else
                            {
                                try
                                {
                                    USER newUser    = model;
                                    var  generateID = (from user in DBEntities.USERs
                                                       orderby user.USER_ID descending
                                                       select user.USER_ID).Take(1).SingleOrDefault();

                                    newUser.FACEBOOK_ID = Convert.ToString(generateID + 1);
                                    newUser.GMAIL_ID    = Convert.ToString(generateID + 1);
                                    newUser.USER_STATUS = (byte)1;
                                    DateTime dateTime = DateTime.UtcNow.Date;
                                    newUser.JOINED_DATE = dateTime.ToString("MM/dd/yyyy");
                                    DBEntities.USERs.Add(newUser);

                                    // tao xong user , tien hanh tao profile
                                    PROFILE newProfile = new PROFILE();
                                    DBEntities.PROFILEs.Add(newProfile);
                                    DBEntities.SaveChanges();
                                    DBTransactions.Commit();
                                    TempData["Message"] = "Chúc mừng tài khoản " + newUser.USERNAME + " đã đăng ký thành công !";
                                    return(RedirectToAction("TrangChu", "FrontEnd"));
                                }catch (Exception)
                                {
                                    DBTransactions.Rollback();
                                    DBEntities.Database.ExecuteSqlCommand("USE PartTimeJob;DECLARE @lastIdent int;SET @lastIdent = (SELECT TOP 1 USER_ID FROM[USER] ORDER BY USER_ID DESC);IF @lastIdent IS NULL BEGIN SET @lastIdent=1;END;DBCC CHECKIDENT('dbo.USER',RESEED,@lastIdent);");
                                    DBEntities.Database.ExecuteSqlCommand("USE PartTimeJob;DECLARE @lastIdent int;SET @lastIdent = (SELECT TOP 1 PROFILE_ID FROM[PROFILE] ORDER BY PROFILE_ID DESC);IF @lastIdent IS NULL BEGIN SET @lastIdent=1;END;DBCC CHECKIDENT('dbo.PROFILE',RESEED,@lastIdent);");
                                    TempData["Message"] = "Có lỗi xảy ra trong hệ thống, vui lòng thử lại sau";
                                    return(RedirectToAction("TrangChu", "FrontEnd"));
                                }
                            }
                        }
                    }
                }
            }
        }