private void AddCompanyCommandHandler(object sender, RoutedEventArgs e)
        {
            EditCompanyWindow window = new EditCompanyWindow();

            window.ShowDialog();
            window = null;
            ModelContainerHolder.UpdateModel();
        }
Esempio n. 2
0
 public CaseWindow(Cases pCase)
 {
     InitializeComponent();
     ModelContainerHolder.UpdateModel();
     m_case = pCase;
     ModelContainerHolder.Model.Cases.Attach(m_case);
     this.Title = pCase.Id.ToString() + " - " + pCase.Customer.Name;
     InitBindings();
 }
        private void SaveCommandHandler(object sender, RoutedEventArgs e)
        {
            if (CompanyComboBox != null)
            {
                m_customer.Company = CompanyComboBox.SelectedItem as Companies;
            }

            ModelContainerHolder.Model.SaveChanges();
            ModelContainerHolder.UpdateModel();
            this.Close();
        }
        public EditCustomerWindow(Customers customer)
        {
            ModelContainerHolder.UpdateModel();
            m_customer = customer;

            m_name    = m_customer.Name;
            m_phone   = m_customer.PhoneNumber;
            m_company = m_customer.Company;


            ModelContainerHolder.Model.Customers.Attach(m_customer);
            InitializeComponent();
            InitBindings();
        }
Esempio n. 5
0
        protected override void IncomingCall(string ownerNumber, string callerNumber, string time)
        {
            try
            {
                Users usr = ModelContainerHolder.Model.Users.Where(a => a.PhoneNumber == ownerNumber).FirstOrDefault();
                if (usr == null)
                {
                    throw new Exception("Couldnt match number with owner"); //Better exception
                }
                //Create new case
                int newCaseID = ModelContainerHolder.NewCase(callerNumber, usr.Id, DateTime.Parse(time));
                if (newCaseID == -1)
                {
                    throw new Exception("Couldnt create new case.");
                }
                //Notify PC
                AndroidPcPair pair = new AndroidPcPair();
                if (m_pairMap.TryGetValue(usr.Id, out pair))
                {
                    pair.CurrentCaseId = newCaseID.ToString();
                    if (pair.Android != null)
                    {
                        m_transmitter.Send("00|" + newCaseID, pair.Android); //Send caseId to Phone.
                    }
                    else
                    {
                        throw new Exception("Not paired with phone");
                    }

                    if (pair.Pc != null)
                    {
                        m_transmitter.Send("00|" + newCaseID, pair.Pc); //Send caseId to PC.
                    }
                    else
                    {
                        throw new Exception("Not paired with PC.");
                    }
                }
                else
                {
                    throw new Exception("Not paired with phone");
                }
            }
            catch (Exception e)
            {
                //Error..
            }
        }