예제 #1
0
        public RoomChangeForm(int _id, MainForm _owner)
        {
            id = _id;
            InitializeComponent();
            owner = _owner;
            if (id != 0)
            {
                ConectionDB.Connection("select type_id, price, type_of_number.type from type_of_number ", cmType);
                cmType.Text         = ConectionDB.ReturnResultLikeString(String.Format("select type_of_number.type from type_of_number where type_id = (select type_id from hotel_room where room_id = {0})", id));
                tbNum.Text          = ConectionDB.ReturnResultLikeString(String.Format("select number_of_room from hotel_room where room_id = {0}", id));
                nudSleepPoint.Value = Convert.ToInt32(ConectionDB.ReturnResultLikeString(String.Format("select amount_of_sleeppoint from hotel_room where room_id = {0}", id)));
                nupFloor.Value      = Convert.ToInt32(ConectionDB.ReturnResultLikeString(String.Format("select floor_of_room from hotel_room where room_id = {0}", id)));
                ConectionDB.ConnectionSecondCMB("select name_type from type_of_bed", cbBed);
                cmType.Text = ConectionDB.ReturnResultLikeString(String.Format("select name_type from type_of_bed where type_id = (select type_of_bed_id from hotel_room where room_id = {0})", id));
            }
            string    appPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\";
            DataTable result  = ConectionDB.ReturnResult(String.Format("select images_path from rooms_images where rooms_id={0}", id));
            int       y       = result.Rows.Count;

            foreach (DataRow item in result.Rows)
            {
                listOfStr.Add(item[0].ToString());
                PictureBox pb = new PictureBox();
                pb.Name     = count.ToString();
                pb.SizeMode = PictureBoxSizeMode.Zoom;
                pb.Image    = new Bitmap(appPath + listOfStr.Last());
                flpPhotos.Controls.Add(pb);
                globalPBList.Add(pb);
                pb.Click += new EventHandler(pb_Click);
                count++;
            }
        }
예제 #2
0
        private void ShowResult()
        {
            //проверка на дату

            dgvMain.Columns.Clear();
            queryLong = @"select * from hotel_room where state = 'Свободен' ";

            if (clbType.CheckedItems.Count != 0)
            {
                queryLong = queryLong.Insert(queryLong.Length, " and type_id in (select type_id from type_of_number where type_of_number.type in(" + GetQueryLikeStrinOr(clbType) + "))");
            }
            if (clbServices.CheckedItems.Count != 0)
            {
                queryLong += GetQueryLikeStringAnd(clbServices);
            }
            if (rbTwo.Checked || rbThree.Checked || rbOne.Checked)
            {
                queryLong = queryLong.Insert(queryLong.Length, " and amount_of_sleeppoint = " + GetCheckRadioButton() + "");
            }
            queryLong += timeQuery;
            ConectionDB.Connection(queryLong, dgvMain);
            flpMain.Controls.Clear();
            for (int i = 0; i < dgvMain.Rows.Count; i++)
            {
                flpMain.Controls.Add(new ResultForSearchPanelControl(Convert.ToInt32(dgvMain[0, i].Value)));
            }
        }
예제 #3
0
 private void btClose_Click(object sender, EventArgs e)
 {
     if (newClient)
     {
         if (tbSurname.Text != "" && tbFirstName.Text != "" && rtbIdentify.Text != "" && tbPhone.MaskCompleted)
         {
             ConectionDB.Connection(String.Format("insert into clients (surname, first_name, last_name, identify, email, phone) values('{0}','{1}','{2}','{3}','{4}','{5}')", tbSurname.Text,
                                                  tbFirstName.Text, tbLastName.Text, rtbIdentify.Text, tbEmail.Text, tbPhone.Text));
             this.Close();
         }
         else
         {
             MessageBox.Show("Введены не все данные", "Ошибка", MessageBoxButtons.OK);
         }
     }
     else
     {
         if (tbSurname.Text != "" && tbFirstName.Text != "" && rtbIdentify.Text != "" && tbPhone.MaskCompleted)
         {
             ConectionDB.Connection(String.Format("update clients set surname = '{0}', first_name ='{1}', last_name = '{2}', identify = '{3}', email = '{4}', phone = '{5}' where clients_id = {6}", tbSurname.Text,
                                                  tbFirstName.Text, tbLastName.Text, rtbIdentify.Text, tbEmail.Text, tbPhone.Text, id));
             this.Close();
         }
         else
         {
             MessageBox.Show("Введены не все данные", "Ошибка", MessageBoxButtons.OK);
         }
     }
 }
예제 #4
0
       public void TakeQueryList()
       {
           foreach (AddServices items in flpServces.Controls)
           {
               int servId = Convert.ToInt32(ConectionDB.ReturnResultLikeString(String.Format("select service_id from services where service_name = '{0}'", items.cmServices.Text.ToString())));
               ConectionDB.Connection(String.Format("insert into bill (service_id, amount, summa, main_bill_id) values ({0}, {1}, {2}, {3})", servId, items.nudAmount.Value, Convert.ToInt32(items.tbPrice.Text.ToString()), id));
 
           }
       }
예제 #5
0
 private void btDelete_Click(object sender, EventArgs e)
 {
     if (selectedId != 0)
     {
         ConectionDB.Connection(String.Format("delete from services where service_id = {0}", selectedId));
         MainForm mf = (MainForm)Application.OpenForms["MainForm"];
         mf.TablesUpload("services");
     }
 }
 private void FillFields(int id)
 {
     labelType.Text  += ConectionDB.ReturnResultLikeString(String.Format("select type_of_number.type from type_of_number where type_id = (select type_id from hotel_room where room_id = {0})", id));
     labelFloor.Text += ConectionDB.ReturnResultLikeString(String.Format("select floor_of_room from hotel_room where room_id = {0}", id));
     labelNum.Text   += ConectionDB.ReturnResultLikeString(String.Format("select number_of_room from hotel_room where room_id = {0}", id));
     labelSleep.Text += ConectionDB.ReturnResultLikeString(String.Format("select amount_of_sleeppoint from hotel_room where room_id = {0}", id)) + ", " + ConectionDB.ReturnResultLikeString(String.Format("select name_type from type_of_bed where type_id = (select type_of_bed_id from hotel_room where room_id = {0})", id));
     ConectionDB.Connection("select name_services from list_of_free_services where service_id in (select service_id from rooms_services where id in (select id from rooms_services where room_id = " + id.ToString() + "))", lbFreeServices);
     ShowImages();
 }
예제 #7
0
 private void btCreate_Click(object sender, EventArgs e)
 {
     if (InformationClass.queryNew != "")
     {
         InformationClass.clientId = Convert.ToInt32(ConectionDB.ReturnResultLikeString(InformationClass.queryNew));
     }
     ConectionDB.Connection(String.Format("insert into card_of_registration (clients_id, room_id, data_set, data_out, type_pay_id) values ({0}, {1}, '{2}', '{3}', {4})", InformationClass.clientId, InformationClass.roomId, InformationClass.start.ToShortDateString(), InformationClass.finish.ToShortDateString(), ConectionDB.ReturnResultLikeString(String.Format("select type_id from type_of_pay where name_type = '{0}'", cmPay.Text.ToString()))));
     ConectionDB.Connection(String.Format("insert into final_bill (clients_id, number_of_days, final_summa, room_id) values ({0}, {1}, {2}, {3})", InformationClass.clientId, Convert.ToInt32(lbDays.Text), Convert.ToInt32(lbSum.Text), InformationClass.roomId));
     this.Close();
 }
예제 #8
0
        private void btChange_Click(object sender, EventArgs e)
        {
            ConectionDB.Connection("Delete from rooms_services where room_id = (select room_id from hotel_room where number_of_room = '" + cbNumber.Text + "');");

            for (int i = 0; i < clbFreeServices.Items.Count; i++)
            {
                if (clbFreeServices.GetItemChecked(i))
                {
                    ConectionDB.Connection("Insert into rooms_services (room_id, service_id) values (" + ConectionDB.ReturnResult("select room_id from hotel_room where number_of_room = '" + cbNumber.Text + "';").Rows[0]["room_id"].ToString() + ", " + (i + 1) + ")");
                }
            }
        }
예제 #9
0
        public HardQueryControl()
        {
            InitializeComponent();
            ConectionDB.Connection("Select * from type_of_number;", clbType);

            ConectionDB.Connection("Select * from list_of_free_services;", clbServices);
            dtpStart.MinDate        = DateTime.Today;
            dtpStart.Value          = DateTime.Today;
            dtpEnd.MinDate          = DateTime.Today.AddHours(24).AddDays(DateTime.Today.Hour >= 12 ? 1 : 0);
            InformationClass.start  = startDate;
            InformationClass.finish = finishDate;
        }
 private void rbDBClient_CheckedChanged(object sender, EventArgs e)
 {
     dgvClients.Enabled = true;
     gbClients.Enabled  = false;
     gbClients.Enabled  = false;
     flagNewClient      = false;
     if (dgvClients != null)
     {
         ConectionDB.Connection(@"SELECT clients_id, surname as ""Фамилия"", first_name as ""Имя"", last_name as ""Отчество"", identify as ""Документ"", email as ""E-mail"", phone as ""Телефон"" from clients", dgvClients);
     }
     dgvClients.Columns[0].Visible = false;
 }
예제 #11
0
        private void tbControlPayServices_Selecting(object sender, TabControlCancelEventArgs e)
        {
            if (tbControlPayServices.SelectedTab == tbControlFreeServices)
            {
                ConectionDB.Connection("Select * from hotel_room;", cbNumber);
                ConectionDB.Connection("Select * from list_of_free_services;", clbFreeServices);

                listOfString = new List <string>();
                foreach (var item in clbFreeServices.Items)
                {
                    listOfString.Add(((DataRowView)item)[1].ToString());
                }
            }
        }
예제 #12
0
        private void btNext_Click(object sender, EventArgs e)
        {
            if (countPanel == 0)
            {
                if (selectClientNewRequestControl1.isFullField())
                {
                    hardQueryControl1.Show();
                    hardQueryControl1.BringToFront();
                    dgv            = (DataGridView)hardQueryControl1.Controls["dgvMain"];
                    grpbx          = (GroupBox)hardQueryControl1.Controls["gbSleepPoint"];
                    clbType        = (CheckedListBox)hardQueryControl1.Controls["clbType"];
                    clbSer         = (CheckedListBox)hardQueryControl1.Controls["clbServices"];
                    one            = (RadioButton)hardQueryControl1.Controls["rbOne"];
                    two            = (RadioButton)hardQueryControl1.Controls["rbTwo"];
                    three          = (RadioButton)hardQueryControl1.Controls["rbThree"];
                    btPrev.Visible = true;
                    ConectionDB.Connection(queryLong, dgv);
                    countPanel++;
                    btNext.Text    = "Показать результаты";
                    mainLabel.Text = "Выберите номер";
                    btNext.Visible = false;
                    if (selectClientNewRequestControl1.flagNewClient)
                    {
                        queryNewClient = String.Format("insert into clients (surname, first_name, last_name, identify, email, phone) values('{0}','{1}','{2}','{3}','{4}','{5}') RETURNING clients_id", selectClientNewRequestControl1.tbSurname.Text,
                                                       selectClientNewRequestControl1.tbFirstName.Text, selectClientNewRequestControl1.tbLastName.Text, selectClientNewRequestControl1.rtbIdentify.Text, selectClientNewRequestControl1.tbEmail.Text, selectClientNewRequestControl1.tbPhone.Text);
                        InformationClass.queryNew  = queryNewClient;
                        InformationClass.surname   = selectClientNewRequestControl1.tbFirstName.Text;
                        InformationClass.firstName = selectClientNewRequestControl1.tbSurname.Text;
                    }
                    else
                    {
                        indexClient = selectClientNewRequestControl1.idForNewForm;
                    }
                }
                else
                {
                    MessageBox.Show("Введены не все данные", " Ошибка", MessageBoxButtons.OK);
                }
            }

            else if (countPanel == 1)
            {
                mainLabel.Text = "Выберите номер";
                countPanel++;
            }
        }
예제 #13
0
        private void btOK_Click(object sender, EventArgs e)
        {
            if (tbPrice.Text != "" && tbName.Text != "")
            {
                if (isNew)
                {
                    ConectionDB.Connection(String.Format("insert into services (service_name, price_of_service) values ('{0}', {1})", tbName.Text, tbPrice.Text));
                }
                else
                {
                    ConectionDB.Connection(String.Format("update services set service_name = '{0}', price_of_service = {1} where service_id = {2}", tbName.Text, tbPrice.Text, id));
                }

                this.Close();
            }
            else
            {
                MessageBox.Show("Заполните все данные", "Ошибка");
            }
        }
예제 #14
0
        private void ShowResult()
        {
            //проверка на дату
            dgv.Columns.Clear();
            queryLong = @"select * from hotel_room where state = 'Свободен' and ";

            if (clbType.CheckedItems.Count != 0)
            {
                queryLong = queryLong.Insert(queryLong.Length, " and type_id in (select type_id from type_of_number where type_of_number.type in(" + GetQueryLikeStrinOr(clbType) + "))");
            }
            if (clbSer.CheckedItems.Count != 0)
            {
                queryLong += GetQueryLikeStringAnd(clbSer);
            }
            if (one.Checked || two.Checked || three.Checked)
            {
                queryLong = queryLong.Insert(queryLong.Length, " and amount_of_sleeppoint = " + GetCheckRadioButton() + "");
            }
            ConectionDB.Connection(queryLong, dgv);
        }
예제 #15
0
        private void btChange_Click(object sender, EventArgs e)
        {
            int buf    = Convert.ToInt32(ConectionDB.ReturnResultLikeString(String.Format("select type_id from type_of_number where type_of_number.type = '{0}'", cmType.Text.ToString())));
            int bufBed = Convert.ToInt32(ConectionDB.ReturnResultLikeString(String.Format("select type_id from type_of_bed where name_type = '{0}'", cbBed.Text.ToString())));

            ConectionDB.Connection(String.Format("update hotel_room set type_id = '{0}', number_of_room ='{1}', amount_of_sleeppoint = '{2}', floor_of_room = '{3}', type_of_bed_id = {5} where room_id = {4}",
                                                 buf, tbNum.Text, nudSleepPoint.Value, nupFloor.Value, id, bufBed));

            try
            {
                int count = 0;
                foreach (var item in listOfPB)
                {
                    Image oldImg = item.Image;

                    // save to a memorystream
                    MemoryStream ms = new MemoryStream();
                    oldImg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

                    // dispose old image
                    oldImg.Dispose();

                    // save new image to same filename
                    Image newImage = Image.FromStream(ms);
                    newImage.Save(appPath + listOfPaths[count]);


                    //item.Image.Save(appPath + listOfPaths[count], System.Drawing.Imaging.ImageFormat.Jpeg);
                    ConectionDB.Connection(String.Format("insert into rooms_images (rooms_id, images_path) values ({0}, '{1}')", id, listOfPaths[count]));
                    count++;
                }
            }
            catch
            {
                MessageBox.Show("Невозможно сохранить изображение", "Ошибка",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.Close();
        }
예제 #16
0
        private void btChange_Click(object sender, EventArgs e)
        {
            ConectionDB.Connection(String.Format("update type_of_number set type = '{0}', price = {1} where type_id = {2}", cmType.Text, tbPrice.Text, id));

            this.Close();
        }
예제 #17
0
 private void button2_Click(object sender, EventArgs e)
 {
     ConectionDB.Connection(String.Format("update final_bill set final_summa = {0} where final_bill_id = {1}", Convert.ToInt32(tbSum.Text.ToString()), id));
     TakeQueryList();
     this.Close();
 }