Exemplo n.º 1
0
        /// <summary>
        /// Създаване на нов запис спрямо това кой е извикал формата
        /// </summary>
        private void insertRow()
        {
            switch (menuCaller)
            {
            case "Genres":
            {
                Genres g = new Genres(dataBox.Text);
                ViewControl.Instance.setData(g, "Genres");
                break;
            }

            case "Services":
            {
                ServicesNames s = new ServicesNames(dataBox.Text, float.Parse(String.Format("{0:F2}", priceBox.Text)));

                ViewControl.Instance.setData(s, "ServicesNames");
                break;
            }

            case "Types":
            {
                Types t = new Types(dataBox.Text);
                ViewControl.Instance.setData(t, "Types");
                break;
            }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Премахване на запис
        /// </summary>
        /// <param name="s">Записът, който ще премахваме</param>
        /// <returns>Връща true ако премахването е успешно</returns>
        public bool removeRecord(ServicesNames s)
        {
            if (!checkIfInside(s))
            {
                MessageBox.Show("Не можe");
                return(false);
            }

            foreach (ServicesNames n in servicesArray)
            {
                if (n.getServName() == s.getServName())
                {
                    s.setServID(n.getServID());
                    servicesArray.Remove(n);
                    if (!servicesTable.Delete(s))
                    {
                        MessageBox.Show("no");
                        return(false);
                    }
                }
            }

            MessageBox.Show("yes");
            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Промяна на запис спрямо това кой е извикал формата
        /// </summary>
        private void updateRow()
        {
            switch (menuCaller)
            {
            case "Genres":
            {
                Genres g = new Genres();
                g.setGenreID(this.genreID);
                g.setGenreName(dataBox.Text);
                ViewControl.Instance.chandeData(g, "Genres");
                break;
            }

            case "Services":
            {
                ServicesNames s = new ServicesNames();
                s.setServID(serviceID);
                s.setServName(dataBox.Text);
                s.setServPrice(float.Parse(priceBox.Text));
                ViewControl.Instance.chandeData(s, "Services");
                break;
            }

            case "Types":
            {
                Types t = new Types();
                t.setID(typeID);
                t.setType(dataBox.Text);
                ViewControl.Instance.chandeData(t, "Types");
                break;
            }
            }
        }
Exemplo n.º 4
0
        public AddMarker(DPoint markerPoint, int markerId) : this(markerPoint)
        {
            MarkerId = markerId;
            var bankBranch = Program.db.GetBankBranchById(markerId);
            comboBoxBank.Text        = Program.db.GetBankById(bankBranch.Bank_Id).Name;
            textBoxBranchNumber.Text = bankBranch.Name;
            textBoxAddress.Text      = bankBranch.Address;
            breakTextBox.Text        = bankBranch.BreakTime;

            if (bankBranch.OpenDate.Value != null)
            {
                dateTimePickerOpenDate.Value = bankBranch.OpenDate.Value;
            }

            richTextBoxOperatorAdditionalInformation.Text = bankBranch.OperatorInfo;
            textBoxPhone.Text = bankBranch.PhoneNumber;
            var services = bankBranch.ServicesSet.ToList();
            for (int i = 0; i < listBoxServicesInfo.Items.Count; ++i)
            {
                ServicesNames ob = listBoxServicesInfo.Items[i] as ServicesNames;
                for (int j = 0; j < bankBranch.ServicesSet.Count; ++j)
                {
                    if (ob.Name == services[j].Name)
                    {
                        listBoxServicesInfo.SetItemChecked(i, true);
                    }
                }
            }
            textBoxWorkTime.Text = bankBranch.WorkTime;
            removeBtn.Enabled    = true;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Проверява дали има дублиращ запис
 /// </summary>
 /// <param name="s">Записът, който проверяваме</param>
 /// <returns>Връща true ако записът не се дублира</returns>
 private bool checkDuplicateRecord(ServicesNames s)
 {
     foreach (ServicesNames n in servicesArray)
     {
         if (n.getServName() == s.getServName())
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Проверка дали записът съществува в масива
 /// </summary>
 /// <param name="s">Записът, който търсим</param>
 /// <returns>Връща true ако записът съществува </returns>
 private bool checkIfInside(ServicesNames s)
 {
     foreach (ServicesNames n in servicesArray)
     {
         if (n.getServID() == s.getServID())
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Функция за добавяне на запис
        /// </summary>
        /// <param name="s">Записът, който ще добавяме</param>
        /// <returns>Връща true ако записът е добавен успешно</returns>
        public bool insertRow(ServicesNames s)
        {
            if (!checkDuplicateRecord(s))
            {
                MessageBox.Show("Този град вече съществува.");
                return(false);
            }

            if (!servicesTable.Insert("SERVICES", s))
            {
                MessageBox.Show("Неуспешен опит за извършване на операцията. ");
                return(false);
            }

            addNewRecord(s);
            return(true);
        }
Exemplo n.º 8
0
 void CreateBranchFromForm(ref BankBranch newBankBranch)
 {
     newBankBranch.Name         = textBoxBranchNumber.Text;
     newBankBranch.Address      = textBoxAddress.Text;
     newBankBranch.BreakTime    = breakTextBox.Text;
     newBankBranch.OpenDate     = dateTimePickerOpenDate.Value;
     newBankBranch.OperatorInfo = richTextBoxOperatorAdditionalInformation.Text;
     newBankBranch.PhoneNumber  = textBoxPhone.Text;
     foreach (var checkedItem in listBoxServicesInfo.CheckedItems)
     {
         ServicesNames checkBox = (ServicesNames)checkedItem;
         newBankBranch.ServicesSet.Add(new Services()
         {
             Name = checkBox.Name
         });
     }
     newBankBranch.WorkTime = textBoxWorkTime.Text;
     newBankBranch.Xpos     = MarkerDPoint.X;
     newBankBranch.Ypos     = MarkerDPoint.Y;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Функция за промяна на запис
        /// </summary>
        /// <param name="s">Вече промененият запис</param>
        /// <returns>Връща true ако промяната е станала успешно</returns>
        public bool changeRow(ServicesNames s)
        {
            if (!checkIfInside(s))
            {
                MessageBox.Show("Не можe");
                return(false);
            }

            foreach (ServicesNames n in servicesArray)
            {
                if (n.getServID() == s.getServID())
                {
                    n.setServName(s.getServName());
                    n.setServPrice(s.getServPrice());
                    if (!servicesTable.Update("SERVICES", n))
                    {
                        MessageBox.Show("no");
                        return(false);
                    }
                    MessageBox.Show("yes");
                }
            }
            return(true);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Добавяне на нов запис в буферния масив
 /// </summary>
 /// <param name="s">Записът, който добавяме</param>
 private void addNewRecord(ServicesNames s)
 {
     servicesArray.Add(s);
 }