コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            TitleStatus titleStatus = db.TitleStatuses.Find(id);

            db.TitleStatuses.Remove(titleStatus);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public void LoadTitle(Title t)
 {
     _notifyChanges = false;
     UpdateUIFromTitle(t);
     _currentTitle  = t;
     _status        = TitleStatus.Initial;
     _notifyChanges = true;
 }
コード例 #3
0
 private void _savedTitle(EventArgs e)
 {
     if (SavedTitle != null && Status == TitleStatus.UnsavedChanges)
     {
         _status = TitleStatus.Saved;
         SavedTitle(this, e);
     }
 }
コード例 #4
0
 private void _titleChanged(EventArgs e)
 {
     if (TitleChanged != null && Status != TitleStatus.UnsavedChanges && _notifyChanges)
     {
         _status = TitleStatus.UnsavedChanges;
         TitleChanged(this, e);
     }
 }
コード例 #5
0
 private void _titleNameChanged(EventArgs e)
 {
     if (TitleNameChanged != null && _notifyChanges)
     {
         _titleName = tbName.Text;
         _status    = TitleStatus.UnsavedChanges;
         TitleNameChanged(this, e);
     }
 }
コード例 #6
0
        public JsonResult AjaxDelete(int id)
        {
            TitleStatus titleStatus = db.TitleStatuses.Find(id);

            db.TitleStatuses.Remove(titleStatus);
            db.SaveChanges();
            string confirmMessage = string.Format("Deleted title status '{0}' from database!", titleStatus.TitleStatusName);

            return(Json(new { id = id, message = confirmMessage }));
        }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "TitleStatusID,TitleStatusName,Notes")] TitleStatus titleStatus)
 {
     if (ModelState.IsValid)
     {
         db.Entry(titleStatus).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(titleStatus));
 }
コード例 #8
0
 public Title(int id, string name, int companyId, Company company,
              TitleStatus titleStatus, ColectionStatus colectionStatus)
 {
     Id              = id;
     Name            = name;
     CompanyId       = companyId;
     Company         = company;
     TitleStatus     = titleStatus;
     ColectionStatus = colectionStatus;
 }
コード例 #9
0
        public ActionResult Create([Bind(Include = "TitleStatusID,TitleStatusName,Notes")] TitleStatus titleStatus)
        {
            if (ModelState.IsValid)
            {
                db.TitleStatuses.Add(titleStatus);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(titleStatus));
        }
コード例 #10
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TitleStatus titleStatus = db.TitleStatuses.Find(id);

            if (titleStatus == null)
            {
                return(HttpNotFound());
            }
            return(View(titleStatus));
        }
コード例 #11
0
        /*
         * Frontend page: Update Titles
         * Title: Search titles by identification number
         * Designed: Piyumi
         * User story:
         * Developed: Piyumi
         * Date created: 03/17/2016
         */
        public ActionResult SearchTitleStatus(string identificationNumber)
        {
            //check Session["AuthenticatedUser"] is null or Session["loanCode"] is null
            if (Session["AuthenticatedUser"] == null || Session["loanCode"] == null)
            {
                //return to login page if sessions are null
                return(RedirectToAction("UserLogin", "Login", new { lbl = " Due to inactivity your session has timed out, please log in again." }));
            }
            //Conver session to string variable
            string loanCode = Session["loanCode"].ToString();

            TitleAccess        obj1       = new TitleAccess();
            TitleStatus        obj2       = new TitleStatus();
            List <Models.Unit> resultList = new List <Models.Unit>();

            //Check input parameter:identificationNumber is null or empty and loancode is null or empty
            if ((!string.IsNullOrEmpty(identificationNumber)) && (!string.IsNullOrEmpty(loanCode)))
            {
                //search from units where matching the loan code and last 6 digits of identification number
                resultList = obj1.SearchTitle(loanCode, identificationNumber);
            }
            //Check search result list is not null
            if (resultList != null)
            {
                //filter list if contain active units - 1
                obj2.TitleList = resultList.FindAll(t => t.UnitStatus == 1);
                //Check active units count is 0
                if (obj2.TitleList.Count() == 0)
                {
                    //filter list if contain payoff units - 2
                    obj2.TitleList = resultList.FindAll(t => t.UnitStatus == 2);
                    //Check inactive units count is 0
                    if (obj2.TitleList.Count() == 0)
                    {
                        //filter list if contain inactive units - 0
                        obj2.TitleList = resultList.FindAll(t => t.UnitStatus == 0);
                    }
                }
                //return search result list to view
                return(PartialView(obj2));
            }
            else
            {
                obj2.TitleList = new List <Models.Unit>();
                //return search result list to view
                return(PartialView(obj2));
            }
        }
コード例 #12
0
        /// <summary>
        /// Resets the title editor. This will set the status of the edited title
        /// to 'Normal' (no unsaved changes) and if required clears all the
        /// screen fields
        /// </summary>
        /// <param name="Clear">If set the contents of the titleeditor is blanked.</param>
        public void ClearEditor(bool Clear)
        {
            if (Clear)
            {
                _dvdTitle = null;
                titleSource.DataSource = typeof(Title);
            }

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TitleEditor));
            this.pbFrontCover.Image = ((System.Drawing.Image)(resources.GetObject("pbFrontCover.Image")));
            this.pbBackCover.Image = ((System.Drawing.Image)(resources.GetObject("pbFrontCover.Image")));

            Status = TitleStatus.Normal;
        }
コード例 #13
0
 private void _titleNameChanged(TitleNameChangedEventArgs e)
 {
     if (TitleNameChanged != null && !_isLoading)
     {
         Status = TitleStatus.UnsavedChanges;
         TitleNameChanged(this, e);
     }
 }
コード例 #14
0
        public void LoadDVD(Title dvd)
        {
            /*BinaryFormatter formatter = new BinaryFormatter();
            using (MemoryStream stream = new MemoryStream())
            {
                formatter.Serialize(stream, dvd);
                stream.Position = 0;
                _dvdTitle = (Title)formatter.Deserialize(stream);
            }*/
            _dvdTitle = dvd;
            _isLoading = true;
            titleSource.DataSource = _dvdTitle;
            Status = TitleStatus.Normal;

            cbTitleType.Properties.Items.Clear();

            // Disable certain functions if title is a folder
            if ((_dvdTitle.TitleType & TitleTypes.AllFolders) != 0)
            {
                btnDisks.Enabled = false;

                // Setup titletype combo
                foreach (int titletype in Enum.GetValues(typeof(TitleTypes)))
                {
                    if (((titletype & (int)TitleTypes.AllFolders) != 0) &&
                        ((titletype & (int)TitleTypes.AllFolders) != (int)TitleTypes.AllFolders))
                    {
                        cbTitleType.Properties.Items.Add(Enum.GetName(typeof(TitleTypes), titletype));
                        if (((int)_dvdTitle.TitleType & titletype) != 0)
                        {
                            cbTitleType.SelectedItem = Enum.GetName(typeof(TitleTypes), titletype);
                        }
                    }
                }
            }

            if ((_dvdTitle.TitleType & TitleTypes.AllMedia) != 0)
            {
                btnDisks.Enabled = true;

                // Setup titletype combo
                foreach (int titletype in Enum.GetValues(typeof(TitleTypes)))
                {
                    if (((titletype & (int)TitleTypes.AllMedia) != 0) &&
                        ((titletype & (int)TitleTypes.AllMedia) != (int)TitleTypes.AllMedia))
                    {
                        cbTitleType.Properties.Items.Add(Enum.GetName(typeof(TitleTypes), titletype));
                        if (((int)_dvdTitle.TitleType & titletype) != 0)
                        {
                            cbTitleType.SelectedItem = Enum.GetName(typeof(TitleTypes), titletype);
                        }
                    }
                }
            }
            // todo : solomon : i'm not sure what this code is for but it's crashing right now if you delete a cover image
            //imageWatcherFront.Path = Path.GetDirectoryName(_dvdTitle.FrontCoverPath);
            //imageWatcherFront.Filter = "F*.jpg";

            DrawUserRating((int)_dvdTitle.UserStarRating);

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TitleEditor));

            if (!File.Exists(_dvdTitle.FrontCoverPath))
            {
                this.pbFrontCover.Image = ((System.Drawing.Image)(resources.GetObject("pbFrontCover.Image")));
            }

            if (!File.Exists(_dvdTitle.BackCoverPath))
            {
                this.pbBackCover.Image = ((System.Drawing.Image)(resources.GetObject("pbFrontCover.Image")));
            }

            LoadBackdrops();
            _isLoading = false;
        }
コード例 #15
0
ファイル: Game1.cs プロジェクト: alexmgrau/xna-amoeba
        void UpdateInit(GameTime gameTime)
        {
            MouseState mouseState = Mouse.GetState();
            GamePadState gpState = GamePad.GetState(PlayerIndex.One);

            if (gpState.IsConnected)
            {
                if(gpState.IsButtonDown(Buttons.DPadUp))
                {
                    downU = true;
                }
                if (downU && gpState.IsButtonUp(Buttons.DPadUp))
                {
                    downU = false;
                    switch (Is)
                    {
                        case TitleStatus.OnStart:
                            Is = TitleStatus.OnExit;
                            break;
                        case TitleStatus.OnHelp:
                            Is = TitleStatus.OnStart;
                            break;
                        case TitleStatus.OnExit:
                            Is = TitleStatus.OnHelp;
                            break;
                    }
                }
                if(gpState.IsButtonDown(Buttons.DPadDown))
                {
                    downD = true;
                }
                if (downD && gpState.IsButtonUp(Buttons.DPadDown))
                {
                    downD = false;
                    switch (Is)
                    {
                        case TitleStatus.OnStart:
                            Is = TitleStatus.OnHelp;
                            break;
                        case TitleStatus.OnHelp:
                            Is = TitleStatus.OnExit;
                            break;
                        case TitleStatus.OnExit:
                            Is = TitleStatus.OnStart;
                            break;
                    }
                }
                if(gpState.IsButtonDown(Buttons.A))
                {
                    aDown = true;
                }
                if (aDown && gpState.IsButtonUp(Buttons.A))
                {
                    aDown = false;
                    switch (Is)
                    {
                        case TitleStatus.OnStart:
                            IS = STATUS.Gaming;
                            startTime = gameTime.TotalGameTime.TotalSeconds;
                            break;
                        case TitleStatus.OnHelp:
                            IS = STATUS.Story;
                            break;
                        case TitleStatus.OnExit:
                            this.Exit();
                            break;
                    }
                }
            }
            else
            {
                int x = mouseState.X, y = mouseState.Y;
                Is = TitleStatus.OnNone;
                if (y > 0.5f * height + 32 && y < 0.5f * height + 96)
                    Is = TitleStatus.OnStart;
                if (y > 0.5f * height + 96 && y < 0.5f * height + 160)
                    Is = TitleStatus.OnHelp;
                if (y > 0.5f * height + 160 && y < 0.5f * height + 224)
                    Is = TitleStatus.OnExit;
                if (mouseState.LeftButton == ButtonState.Pressed)
                    switch (Is)
                    {
                        case TitleStatus.OnStart:
                            IS = STATUS.Gaming;
                            startTime = gameTime.TotalGameTime.TotalSeconds;
                            break;
                        case TitleStatus.OnHelp:
                            IS = STATUS.Story;
                            break;
                        case TitleStatus.OnExit:
                            this.Exit();
                            break;
                    }
                IsMouseVisible = true;
            }
        }
コード例 #16
0
        /*
         * Frontend page: Update Titles
         * Title: Return View of Update Titles page
         * Designed: Piyumi
         * User story:
         * Developed: Piyumi
         * Date created: 03/17/2016
         */
        public ActionResult TitleStatusUpdate()
        {
            //Check Session["IsTitleTrack"] is not null and value is 0
            if (Session["IsTitleTrack"] != null && int.Parse(Session["IsTitleTrack"].ToString()) == 0)
            {
                //return to dashboard if title doesnot need to be tracked
                return(RedirectToAction("UserDetails", "UserManagement"));
            }
            //user role 3 - user
            else if (userData.RoleId == 3)
            {
                //Check Session["CurrentLoanRights"] is not null or empty
                if (Session["CurrentLoanRights"] == null || Session["CurrentLoanRights"].ToString() == "")
                {
                    //return to dashboard if Session["CurrentLoanRights"] is null or empty
                    return(RedirectToAction("UserDetails", "UserManagement"));
                }
                else
                {
                    var    checkPermission = false;
                    string rgts            = "";
                    //convert Session["CurrentLoanRights"] to string
                    rgts = (string)Session["CurrentLoanRights"];
                    string[] rgtList = null;
                    //Check string is not empty
                    if (rgts != "")
                    {
                        //split right string and insert to a list
                        rgtList = rgts.Split(',');
                    }
                    //Check list is not null
                    if (rgtList != null)
                    {
                        foreach (var x in rgtList)
                        {
                            //Check right list contains the relevant right which represent Update Titles page
                            if (x == "U02")
                            {
                                checkPermission = true;
                            }
                        }
                        //Check user is given permission to Update Titles page
                        if (checkPermission == false)
                        {
                            //if no permission to Update Titles page return to dashboard
                            return(RedirectToAction("UserDetails", "UserManagement"));
                        }
                    }
                    else
                    {
                        //if right list is null return to dashboard
                        return(RedirectToAction("UserDetails", "UserManagement"));
                    }
                }
            }
            //user role 4 - dealer user
            else if (userData.RoleId == 4)
            {
                //if dealer user return to dashboard
                return(RedirectToAction("UserDetails", "UserManagement"));
            }
            TitleStatus obj2 = new TitleStatus();

            obj2.TitleList = new List <Models.Unit>();
            int compType = 0;

            //get company type by company id
            if (userData.UserId > 0)
            {
                BranchAccess obj1 = new BranchAccess();
                compType = obj1.getCompanyTypeByUserId(userData.UserId);
            }
            //Check company type is greater than 0
            if (compType > 0)
            {
                //assign company type to viewbag variable
                ViewBag.CompanyType = compType;
            }
            int flag = -1;

            //Check result after updating title status
            if ((TempData["reslt"] != null) && (TempData["reslt"].ToString() != ""))
            {
                //assign result value to a variable
                flag = int.Parse(TempData["reslt"].ToString());
                //Check value of result
                if (flag == 1)
                {
                    ViewBag.Msg = "Success";
                }
                else if (flag == 0)
                {
                    ViewBag.Msg = "Error";
                }
                //return TitleStatus model object to view
                return(View(obj2));
            }
            else
            {
                //return TitleStatus model object to view
                return(View(obj2));
            }
        }
コード例 #17
0
 private void _titleNameChanged(EventArgs e)
 {
     if (TitleNameChanged != null && _notifyChanges)
     {
         _titleName = tbName.Text;
         _status = TitleStatus.UnsavedChanges;
         TitleNameChanged(this, e);
     }
 }
コード例 #18
0
 public JsonResult AjaxCreate(TitleStatus titleStatus)
 {
     db.TitleStatuses.Add(titleStatus);
     db.SaveChanges();
     return(Json(titleStatus));
 }
コード例 #19
0
 private void _titleChanged(EventArgs e)
 {
     if (TitleChanged != null && Status != TitleStatus.UnsavedChanges && _notifyChanges)
     {
         _status = TitleStatus.UnsavedChanges;
         TitleChanged(this, e);
     }
 }
コード例 #20
0
 private void _savedTitle(EventArgs e)
 {
     if (SavedTitle != null && Status == TitleStatus.UnsavedChanges)
     {
         _status = TitleStatus.Saved;
         SavedTitle(this, e);
     }
 }
コード例 #21
0
 public void LoadTitle(Title t)
 {
     _notifyChanges = false;
     UpdateUIFromTitle(t);
     _currentTitle = t;
     _status = TitleStatus.Initial;
     _notifyChanges = true;
 }
コード例 #22
0
        public PartialViewResult TitleStatusEdit(int id)
        {
            TitleStatus titleStatus = db.TitleStatuses.Find(id);

            return(PartialView(titleStatus));
        }
コード例 #23
0
 public JsonResult AjaxEdit(TitleStatus titleStatus)
 {
     db.Entry(titleStatus).State = EntityState.Modified;
     db.SaveChanges();
     return(Json(titleStatus));
 }