Example #1
0
        protected override void ResetPageContentTitleTextBoxKeyBind(KeyBinder <TextBox> binder)
        {
            ResetTextBoxKeyBind(binder);

            binder.SetBind(Keys.None, Keys.Enter, "FocusEditorCanvas");
            binder.SetBind(Keys.None, Keys.W | Keys.Control, "CloseTabPage");
        }
        public static void SaveInvoice(DSModel db, KeyBinder key, InvoiceModel model)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            model.UserID         = GLOB.User.UserID;
            model.LastUpdateTime = DateTime.Now;
            if (model.InvoiceID == 0)
            {
                InsertInvoice(db, key, model);
            }
            else
            {
                UpdateInvoice(db, key, model);
            }
        }
        public CheckResult SaveFile(FileBlobModel model)
        {
            if (!model.IsChanged)
            {
                return(new CheckResult(model));
            }

            using (DSModel db = DB.GetContext())
            {
                var check = FileBlobValidator.ValidateSave(db, model);
                if (check.Failed)
                {
                    return(check);
                }

                KeyBinder key = new KeyBinder();
                try
                {
                    FileBlobRepository.SaveBlob(db, key, model);
                    db.SaveChanges();
                    key.BindKeys();
                    model.IsChanged = false;
                    return(new CheckResult(model));
                }
                catch (Exception ex)
                {
                    key.RollbackKeys();
                    return(new CheckResult(ex));
                }
            }
        }
Example #4
0
        protected override void ResetMemoEditorKeyBind(KeyBinder <IEditor> binder)
        {
            // --- noop ---
            binder.SetBind(Keys.None, Keys.Tab, "DoNothing");
            binder.SetBind(Keys.None, Keys.Tab | Keys.Shift, "DoNothing");

            // --- move ---
            binder.SetBind(Keys.None, Keys.Left, "MoveCaretLeft");
            binder.SetBind(Keys.None, Keys.Right, "MoveCaretRight");
            binder.SetBind(Keys.None, Keys.Up, "MoveCaretUp");
            binder.SetBind(Keys.None, Keys.Down, "MoveCaretDown");

            binder.SetBind(Keys.None, Keys.Home, "MoveCaretLeftMost");
            binder.SetBind(Keys.None, Keys.End, "MoveCaretRightMost");

            binder.SetBind(Keys.None, Keys.PageUp, "ScrollUp");
            binder.SetBind(Keys.None, Keys.PageDown, "ScrollDown");

            // --- select ---
            binder.SetBind(Keys.None, Keys.A | Keys.Control, "SelectAllChildren");

            // --- clipboard ---
            binder.SetBind(Keys.None, Keys.V | Keys.Control, "Paste");

            // --- undo ---
            binder.SetBind(Keys.None, Keys.Z | Keys.Control, "Undo");
            binder.SetBind(Keys.None, Keys.Y | Keys.Control, "Redo");

            // --- misc ---
            binder.SetBind(Keys.None, Keys.W | Keys.Control, "CloseTabPage");
        }
Example #5
0
        public CheckResult Delete()
        {
            var model = this.ActiveModel;

            try
            {
                using (var db = DB.GetContext())
                {
                    KeyBinder key = new KeyBinder();

                    var check = DriverLicenseValidator.ValidateDelete(db, model);
                    if (check.Failed)
                    {
                        return(check);
                    }

                    DriverLicenseRepository.DeleteDriverLicense(db, key, model);
                    db.SaveChanges();
                    return(check);
                }
            }
            catch (Exception ex)
            {
                return(new CheckResult(ex));
            }
        }
        public CheckResult AttachMultipleFiles(string[] files)
        {
            using (var db = DB.GetContext())
            {
                KeyBinder key = new KeyBinder();
                try
                {
                    foreach (string file in files)
                    {
                        FileBlobModel mod = new FileBlobModel();
                        mod.BlobName      = Path.GetFileNameWithoutExtension(file);
                        mod.BlobExtension = Path.GetExtension(file);
                        mod.BlobData      = File.ReadAllBytes(file);
                        mod.DriverID      = this.CreationInfo.DriverID;

                        FileBlobRepository.SaveBlob(db, key, mod);
                    }

                    db.SaveChanges();
                    key.BindKeys();
                    return(new CheckResult());
                }
                catch (Exception ex)
                {
                    key.RollbackKeys();
                    return(new CheckResult(ex));
                }
            }
        }
Example #7
0
        public static void DeleteDriverLicense(DSModel db, KeyBinder key, DriverLicenseModel model)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            db.DriversLicensesPermits
            .Where(p => p.DriverLicenseID == model.DriverLicenseID)
            .DeleteAll();
            db.DriversLicensesReminders
            .Where(l => l.DriverLicenseID == model.DriverLicenseID)
            .DeleteAll();
            db.DriversLicenses
            .Where(d => d.DriverLicenseID == model.DriverLicenseID)
            .DeleteAll();
        }
        public static void SaveBlobView(DSModel db, KeyBinder key, FileBlobViewModel model)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            if (model.BlobID == 0)
            {
                throw new ArgumentException("BlobID cannot be 0!", "model");
            }

            string sql = @"
                UPDATE file_blobs f
                SET
                  f.BlobName = @BlobName, f.BlobDescription = @BlobDescription, f.BlobExtension = @BlobExtension
                WHERE
                  f.BlobID = @BlobID;";

            db.ExecuteNonQuery(sql,
                               new MySqlParameter("BlobID", model.BlobID),
                               new MySqlParameter("BlobName", model.BlobName),
                               new MySqlParameter("BlobDescription", model.BlobDescription),
                               new MySqlParameter("BlobExtension", model.BlobExtension));
        }
Example #9
0
        protected override void ResetMemoTableCellEditorKeyBind(KeyBinder <IEditor> binder)
        {
            // --- move ---
            binder.SetBind(Keys.None, Keys.Left, "MoveLeftCell");
            binder.SetBind(Keys.None, Keys.Right, "MoveRightCell");
            binder.SetBind(Keys.None, Keys.Up, "MoveUpCell");
            binder.SetBind(Keys.None, Keys.Down, "MoveDownCell");

            binder.SetBind(Keys.None, Keys.Enter, "MoveDownCell");
            binder.SetBind(Keys.None, Keys.Tab, "MoveRightCellOrCreateRow");
            binder.SetBind(Keys.None, Keys.Tab | Keys.Shift, "MoveLeftCell");

            binder.SetBind(Keys.None, Keys.Home, "MoveLeftmostCell");
            binder.SetBind(Keys.None, Keys.End, "MoveRightmostCell");

            binder.SetBind(Keys.None, Keys.PageUp, "ScrollUp");
            binder.SetBind(Keys.None, Keys.PageDown, "ScrollDown");

            // --- empty ---
            binder.SetBind(Keys.None, Keys.Delete, "EmptyCell");

            // --- focus ---
            binder.SetBind(Keys.None, Keys.Enter | Keys.Shift, "BeginFocus");
            binder.SetBind(Keys.None, Keys.Enter | Keys.Control, "BeginFocus");

            // --- undo ---
            binder.SetBind(Keys.None, Keys.Z | Keys.Control, "Undo");
            binder.SetBind(Keys.None, Keys.Y | Keys.Control, "Redo");

            // --- misc ---
            binder.SetBind(Keys.None, Keys.W | Keys.Control, "CloseTabPage");
        }
Example #10
0
        public CheckResult SaveUser(UserModel user)
        {
            try
            {
                using (var db = DB.GetContext())
                {
                    var check = UserValidator.ValidateSave(db, user);
                    if (check.Failed)
                    {
                        return(check);
                    }

                    KeyBinder key = new KeyBinder();
                    UserRepository.SaveUser(db, key, user);
                    db.SaveChanges();
                    key.BindKeys();
                    user.IsChanged = false;
                    return(check);
                }
            }
            catch (Exception ex)
            {
                return(new CheckResult(ex));
            }
        }
Example #11
0
        public static void SaveDispatch(DSModel db, KeyBinder key, DispatchModel disp)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (disp == null)
            {
                throw new ArgumentNullException("disp");
            }

            disp.UserID         = GLOB.User.UserID;
            disp.LastUpdateTime = DateTime.Now;
            if (disp.DispatchID == 0)
            {
                InsertDispatch(db, key, disp);
            }
            else
            {
                UpdateDispatch(db, key, disp);
            }
        }
Example #12
0
        protected override void ResetNoSelectionKeyBind(KeyBinder <EditorCanvas> binder)
        {
            // --- select ---
            binder.SetBind(Keys.Q | Keys.Control, Keys.A | Keys.Control, "SelectAllChildren");
            binder.SetBind(Keys.X | Keys.Control, Keys.H, "SelectAllChildren");

            // --- scroll ---
            binder.SetBind(Keys.None, Keys.PageUp, "ScrollUp");
            binder.SetBind(Keys.None, Keys.PageDown, "ScrollDown");
            binder.SetBind(Keys.None, Keys.V | Keys.Alt, "ScrollUp");
            binder.SetBind(Keys.None, Keys.V | Keys.Control, "ScrollDown");

            // --- undo ---
            binder.SetBind(Keys.None, Keys.OemQuestion | Keys.Control, "Undo");
            binder.SetBind(Keys.None, Keys.OemBackslash | Keys.Control | Keys.Shift, "Undo");
            binder.SetBind(Keys.X | Keys.Control, Keys.U, "Undo");

            // --- misc ---
            binder.SetBind(Keys.X | Keys.Control, Keys.K, "CloseTabPage");
            binder.SetBind(Keys.X | Keys.Control, Keys.C | Keys.Control, "CloseAllTabPages");

            // --- misc ---
            binder.SetBind(Keys.X | Keys.Control, Keys.B | Keys.Control, "SelectOpenNotesNodeInWorkspace");
            binder.SetBind(Keys.X | Keys.Control, Keys.D | Keys.Control, "FocusWorkspaceView");
            binder.SetBind(Keys.X | Keys.Control, Keys.F | Keys.Control, "FocusMemoListView");
        }
Example #13
0
        private static void UpdateDispatch(DSModel db, KeyBinder key, DispatchModel model)
        {
            var poco = db.Dispatches.Where(d => d.DispatchID == model.DispatchID).FirstOrDefault();

            if (poco == null)
            {
                throw new ArgumentNullException("No dispatch with the specified ID!");
            }

            poco.DriverID       = model.DriverID;
            poco.CompanyID      = model.CompanyID;
            poco.LocationID     = model.LocationID;
            poco.FromDateTime   = model.FromDateTime;
            poco.ToDateTime     = model.ToDateTime;
            poco.LunchTime      = model.LunchTime;
            poco.TrainingTime   = model.TrainingTime;
            poco.SpecialPayRate = model.SpecialPayRate;
            poco.MiscCharge     = model.MiscCharge;
            poco.Note           = model.Note;
            poco.IsCancelled    = model.IsCancelled;
            poco.IsConfirmed    = model.IsConfirmed;
            poco.HasLunch       = model.HasLunch;
            poco.HasTraining    = model.HasTraining;
            poco.UserID         = model.UserID;
            poco.LastUpdateTime = model.LastUpdateTime;
        }
Example #14
0
        protected override void ResetMemoContentSingleLineFocusKeyBind(KeyBinder <IFocus> binder)
        {
            // --- move ---
            binder.SetBind(Keys.None, Keys.Left, "MoveBackwardChar");
            binder.SetBind(Keys.None, Keys.Right, "MoveForwardChar");

            binder.SetBind(Keys.None, Keys.Home, "MoveBeginningOfLine");
            binder.SetBind(Keys.None, Keys.End, "MoveEndOfLine");

            // --- select ---
            binder.SetBind(Keys.None, Keys.Left | Keys.Shift, "SelectBackwardChar");
            binder.SetBind(Keys.None, Keys.Right | Keys.Shift, "SelectForwardChar");

            // --- enter ---
            binder.SetBind(Keys.None, Keys.Enter, "CommitAndSelect");
            binder.SetBind(Keys.None, Keys.Enter | Keys.Shift, "CommitAndSelect");
            binder.SetBind(Keys.None, Keys.Enter | Keys.Control, "CommitAndSelect");

            // --- clipboard ---
            binder.SetBind(Keys.None, Keys.V | Keys.Control, "PasteLastLine");
            binder.SetBind(Keys.None, Keys.X | Keys.Control, "Cut");
            binder.SetBind(Keys.None, Keys.C | Keys.Control, "Copy");

            // --- undo ---
            binder.SetBind(Keys.None, Keys.Z | Keys.Control, "Undo");
            binder.SetBind(Keys.None, Keys.Y | Keys.Control, "Redo");

            // --- remove ---
            binder.SetBind(Keys.None, Keys.Delete, "RemoveForward");
            binder.SetBind(Keys.None, Keys.Back, "RemoveBackward");

            // --- tab ---
            binder.SetBind(Keys.None, Keys.W | Keys.Control, "CloseTabPage");
        }
Example #15
0
 private bool CheckOpenCloseDebouncedTrigger(KeyBinder binder)
 {
     if (binder.IsPressed)
     {
         if (!sw.IsRunning)
         {
             sw.Start();
         }
         else if (sw.ElapsedMilliseconds > 250)
         {
             sw.Stop();
             sw.Reset();
             return(true);
         }
     }
     else
     {
         if (sw.IsRunning)
         {
             sw.Stop();
             sw.Reset();
         }
     }
     return(false);
 }
Example #16
0
 public override void Initialize()
 {
     Function.Log("Computer+ is loading");
     DetectOpenCloseRequestedFiber   = new GameFiber(CheckToggleComputer);
     RunComputerPlusFiber            = new GameFiber(RunPoliceComputer);
     CheckIfCalloutActiveFiber       = new GameFiber(CheckIfCalloutActive);
     DetectOpenSimpleNotepadFiber    = new GameFiber(CheckOpenSimpleNotepad);
     Functions.OnOnDutyStateChanged += DutyStateChangedHandler;
     OnVehicleStopped += VehicleStoppedHandler;
     Globals.Navigation.OnFormAdded          += NavOnFormAdded;
     Globals.Navigation.OnFormRemoved        += NavOnFormRemoved;
     AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolve);
     Configs.RunConfigCheck();
     if (Game.IsControllerConnected)
     {
         CloseComputerPlusWindow = new KeyBinder(ControllerButtons.X);
     }
     else
     {
         CloseComputerPlusWindow = new KeyBinder(Keys.PageDown);
     }
     OpenCloseComputerPlusBinder = new KeyBinder(GameControl.Context);
     OpenSimpleNotepad           = new KeyBinder(Keys.End);
     Function.checkForRageVersionClass.checkForRageVersion(0.41f);
 }
Example #17
0
        public CheckResult Save()
        {
            var mod = this.ActiveModel;

            try
            {
                using (var db = DB.GetContext())
                {
                    var check = DriverMedicalValidator.ValidateSave(db, mod);
                    if (check.Failed)
                    {
                        return(check);
                    }

                    KeyBinder key = new KeyBinder();
                    DriverMedicalRepository.SaveMedical(db, key, mod);
                    db.SaveChanges();
                    key.BindKeys();
                    mod.IsChanged = false;
                    return(check);
                }
            }
            catch (Exception ex)
            {
                return(new CheckResult(ex));
            }
        }
Example #18
0
        protected override void ResetMemoTableCellFocusKeyBind(KeyBinder <IFocus> binder)
        {
            ResetMemoContentFocusKeyBind(binder);

            binder.SetBind(Keys.None, Keys.Home | Keys.Control, "MoveBeginningOfText");
            binder.SetBind(Keys.None, Keys.End | Keys.Control, "MoveEndOfText");
            binder.SetBind(Keys.None, Keys.Oemcomma | Keys.Alt | Keys.Shift, "MoveBeginningOfText");
            binder.SetBind(Keys.None, Keys.OemPeriod | Keys.Alt | Keys.Shift, "MoveEndOfText");

            // --- move out ---
            binder.SetBind(Keys.None, Keys.B | Keys.Control | Keys.Alt, "MoveOutLeft");
            binder.SetBind(Keys.None, Keys.F | Keys.Control | Keys.Alt, "MoveOutRight");
            binder.SetBind(Keys.None, Keys.P | Keys.Control | Keys.Alt, "MoveOutUp");
            binder.SetBind(Keys.None, Keys.N | Keys.Control | Keys.Alt, "MoveOutDown");

            // --- scroll ---
            binder.SetBind(Keys.None, Keys.L | Keys.Control, "ScrollRecenter");

            // --- tab ---
            binder.SetBind(Keys.X | Keys.Control, Keys.K, "CloseTabPage");
            binder.SetBind(Keys.X | Keys.Control, Keys.C | Keys.Control, "CloseAllTabPages");

            // --- cell ---
            binder.SetBind(Keys.None, Keys.Enter, "CommitAndMoveDownCell");
            binder.SetBind(Keys.None, Keys.Enter | Keys.Alt, "InsertBlockBreak");
            binder.SetBind(Keys.None, Keys.Tab, "CommitAndMoveRightCellOrCreateRow");
            binder.SetBind(Keys.None, Keys.Tab | Keys.Shift, "CommitAndMoveLeftCell");

            // --- misc ---
            binder.SetBind(Keys.X | Keys.Control, Keys.B | Keys.Control, "SelectOpenNotesNodeInWorkspace");
            binder.SetBind(Keys.X | Keys.Control, Keys.D | Keys.Control, "FocusWorkspaceView");
            binder.SetBind(Keys.X | Keys.Control, Keys.F | Keys.Control, "FocusMemoListView");
        }
Example #19
0
        protected override void ResetMemoContentEditorKeyBind(KeyBinder <IEditor> binder)
        {
            // --- move ---
            binder.SetBind(Keys.None, Keys.Left, "MoveLeft");
            binder.SetBind(Keys.None, Keys.Right, "MoveRight");
            binder.SetBind(Keys.None, Keys.Up, "MoveUp");
            binder.SetBind(Keys.None, Keys.Down, "MoveDown");
            binder.SetBind(Keys.None, Keys.B | Keys.Control, "MoveLeft");
            binder.SetBind(Keys.None, Keys.F | Keys.Control, "MoveRight");
            binder.SetBind(Keys.None, Keys.P | Keys.Control, "MoveUp");
            binder.SetBind(Keys.None, Keys.N | Keys.Control, "MoveDown");

            binder.SetBind(Keys.None, Keys.L | Keys.Control, "ScrollRecenter");

            binder.SetBind(Keys.None, Keys.PageUp, "ScrollUp");
            binder.SetBind(Keys.None, Keys.PageDown, "ScrollDown");
            binder.SetBind(Keys.None, Keys.V | Keys.Alt, "ScrollUp");
            binder.SetBind(Keys.None, Keys.V | Keys.Control, "ScrollDown");

            // --- move out ---
            binder.SetBind(Keys.None, Keys.B | Keys.Control | Keys.Alt, "MoveOutLeft");
            binder.SetBind(Keys.None, Keys.F | Keys.Control | Keys.Alt, "MoveOutRight");
            binder.SetBind(Keys.None, Keys.P | Keys.Control | Keys.Alt, "MoveOutUp");
            binder.SetBind(Keys.None, Keys.N | Keys.Control | Keys.Alt, "MoveOutDown");

            // --- select ---
            binder.SetBind(Keys.None, Keys.Tab, "SelectNextElement");
            binder.SetBind(Keys.None, Keys.Tab | Keys.Shift, "SelectPreviousElement");

            // --- remove ---
            binder.SetBind(Keys.None, Keys.Delete, "Remove");
            binder.SetBind(Keys.None, Keys.D | Keys.Control, "Remove");

            // --- clipboard ---
            binder.SetBind(Keys.None, Keys.W | Keys.Control, "Cut");
            binder.SetBind(Keys.None, Keys.W | Keys.Alt, "Copy");

            // --- focus ---
            binder.SetBind(Keys.None, Keys.Enter, "BeginFocus");
            binder.SetBind(Keys.None, Keys.Enter | Keys.Shift, "BeginFocus");
            binder.SetBind(Keys.None, Keys.Enter | Keys.Control, "BeginFocus");

            // --- undo ---
            binder.SetBind(Keys.None, Keys.OemQuestion | Keys.Control, "Undo");
            binder.SetBind(Keys.None, Keys.OemBackslash | Keys.Control, "Undo");
            binder.SetBind(Keys.X | Keys.Control, Keys.U, "Undo");

            // --- misc ---
            binder.SetBind(Keys.X | Keys.Control, Keys.K, "CloseTabPage");
            binder.SetBind(Keys.X | Keys.Control, Keys.C | Keys.Control, "CloseAllTabPages");

            // --- misc ---
            binder.SetBind(Keys.X | Keys.Control, Keys.B | Keys.Control, "SelectOpenNotesNodeInWorkspace");
            binder.SetBind(Keys.X | Keys.Control, Keys.D | Keys.Control, "FocusWorkspaceView");
            binder.SetBind(Keys.X | Keys.Control, Keys.F | Keys.Control, "FocusMemoListView");
        }
Example #20
0
        public void CanSetKeyOnEntity()
        {
            var subject = new KeyBinder <TestEntity, string>(entity => entity.Key, (e, key) => e.Key = key);

            var testEntity = new TestEntity();

            subject.Set(testEntity, "Key2");

            Assert.Equal("Key2", testEntity.Key);
        }
Example #21
0
        public void CanGetKeyFromEntity()
        {
            var subject = new KeyBinder <TestEntity, string>(entity => entity.Key, (e, k) => e.Key = k);

            var key = subject.Get(new TestEntity {
                Key = "Key1"
            });

            Assert.Equal("Key1", key);
        }
Example #22
0
        protected override void ResetComboBoxKeyBind(KeyBinder <ComboBox> binder)
        {
            binder.SetBind(Keys.None, Keys.N | Keys.Control, "NextItem");
            binder.SetBind(Keys.None, Keys.P | Keys.Control, "PreviousItem");

            // --- misc ---
            binder.SetBind(Keys.X | Keys.Control, Keys.B | Keys.Control, "SelectOpenNotesNodeInWorkspace");
            binder.SetBind(Keys.X | Keys.Control, Keys.D | Keys.Control, "FocusWorkspaceView");
            binder.SetBind(Keys.X | Keys.Control, Keys.F | Keys.Control, "FocusMemoListView");
        }
        private static void InsertBlob(DSModel db, KeyBinder key, FileBlobModel model)
        {
            key.AddRollback(model.BlobID, model, model.GetName(p => p.BlobID));
            FileBlob poco = new FileBlob();

            model.Map(poco);
            db.Add(poco);

            key.AddKey(poco, model, model.GetName(p => p.BlobID));
        }
        private static void UpdateBlob(DSModel db, KeyBinder key, FileBlobModel model)
        {
            FileBlob poco = db.FileBlobs.Where(b => b.BlobID == model.BlobID).FirstOrDefault();

            if (poco == null)
            {
                throw new ArgumentException("File does not exist!", "BlobID");
            }
            model.Map(poco);
        }
        private static Location InsertLocation(DSModel db, KeyBinder key, LocationModel model, Company company = null)
        {
            Location poco = new Location();

            poco.LocationName = model.LocationName;
            if (model.LocationCode == string.Empty)
            {
                poco.LocationCode = "L" + LocationRepository.PeekLocationCode(db, "L");
            }
            else
            {
                poco.LocationCode = model.LocationCode;
            }

            if (company == null)
            {
                poco.CompanyID = model.CompanyID;
            }
            else
            {
                poco.Company = company;
            }

            poco.LocationAddress = model.LocationAddress;
            poco.LocationPhone   = model.LocationPhone;
            poco.LocationFax     = model.LocationFax;

            if (model.ConfirmationContact.IsChanged)
            {
                poco.ConfirmationContact = ContactRepository.SaveContact(db, key, model.ConfirmationContact);
                key.AddKey(poco.ConfirmationContact, model.ConfirmationContact, poco.ConfirmationContact.GetName(p => p.ContactID));
                key.AddKey(poco.ConfirmationContact, model, poco.ConfirmationContact.GetName(p => p.ContactID), model.GetName(p => p.ConfirmationContactID));
            }
            if (model.InvoiceContact.IsChanged)
            {
                poco.InvoiceContact = ContactRepository.SaveContact(db, key, model.InvoiceContact);
                key.AddKey(poco.InvoiceContact, model.InvoiceContact, poco.InvoiceContact.GetName(p => p.ContactID));
                key.AddKey(poco.InvoiceContact, model, poco.InvoiceContact.GetName(p => p.ContactID), model.GetName(p => p.InvoiceContactID));
            }
            if (model.DispatchContact.IsChanged)
            {
                poco.DispatchContact = ContactRepository.SaveContact(db, key, model.DispatchContact);
                key.AddKey(poco.DispatchContact, model.DispatchContact, poco.DispatchContact.GetName(p => p.ContactID));
                key.AddKey(poco.DispatchContact, model, poco.DispatchContact.GetName(p => p.ContactID), model.GetName(p => p.DispatchContactID));
            }

            poco.TravelPay           = model.TravelPay;
            poco.TravelPayName       = model.TravelPayName;
            poco.LunchTime           = model.LunchTime;
            poco.IsEnabled           = model.IsEnabled;
            poco.IncludeConfirmation = model.IncludeConfirmation;
            db.Add(poco);
            key.AddKey(poco, model, model.GetName(p => p.LocationID));
            return(poco);
        }
Example #26
0
        private static void UpdateMedical(DSModel db, KeyBinder key, DriverMedicalModel model)
        {
            var poco = db.DriversMedicals
                       .Where(m => m.DriverMedicalID == model.DriverMedicalID)
                       .FirstOrDefault();

            model.Map(poco);
            db.FlushChanges();

            SaveReminders(db, key, model, poco);
        }
Example #27
0
        private static void InsertMedical(DSModel db, KeyBinder key, DriverMedicalModel model)
        {
            DriversMedical poco = new DriversMedical();

            model.Map(poco);
            db.Add(poco);

            key.AddKey(poco, model, model.GetName(p => p.DriverMedicalID));
            db.FlushChanges();
            SaveReminders(db, key, model, poco);
        }
Example #28
0
        public void GetNavigationNodeCreatesCollectionNavigationNodeForManyMultiplicityProperty()
        {
            IEdmNavigationProperty property = HardCodedTestModel.GetDogMyPeopleNavProp();
            SingleEntityNode       parent   = new SingleEntityCastNode(null, HardCodedTestModel.GetDogType());
            BindingState           state    = new BindingState(configuration);
            KeyBinder keyBinder             = new KeyBinder(FakeBindMethods.BindMethodReturningASingleDog);

            var result = InnerPathTokenBinder.GetNavigationNode(property, parent, null, state, keyBinder);

            result.ShouldBeCollectionNavigationNode(property);
        }
Example #29
0
        private static Contact InsertContact(DSModel db, KeyBinder key, ContactModel model)
        {
            Contact poco = new Contact();

            poco.ContactName  = model.ContactName;
            poco.ContactPhone = model.ContactPhone;
            poco.ContactEmail = model.ContactEmail;
            db.Add(poco);
            key.AddKey(poco, model, model.GetName(p => p.ContactID));
            return(poco);
        }
Example #30
0
        public void GetNavigationNodeCreatesSingleNavigationNodeForSingleMultiplicityProperty()
        {
            IEdmNavigationProperty property = HardCodedTestModel.GetPersonMyDogNavProp();
            IEdmNavigationSource   navigationSource;
            SingleResourceNode     parent = new SingleResourceCastNode(null, HardCodedTestModel.GetDogType());
            BindingState           state  = new BindingState(Configuration);
            KeyBinder keyBinder           = new KeyBinder(FakeBindMethods.BindMethodReturningASingleDog);

            var result = InnerPathTokenBinder.GetNavigationNode(property, parent, null, state, keyBinder, out navigationSource);

            result.ShouldBeSingleNavigationNode(property);
        }