private void executeSp(string path, string numArchivos)
        {
            ConectionDB con = new ConectionDB();

            try
            {
                con.SqlConnect();

                SqlCommand cmd = new SqlCommand();
                //CONFIG OF THE COMMAND
                cmd.Connection  = con.GetConnection();
                cmd.CommandText = Sp;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@RUTA", path);
                cmd.Parameters.AddWithValue("@NUMARCHIVOS", numArchivos);

                cmd.ExecuteNonQuery();

                cmd.Parameters.Clear();

                MessageBox.Show("Se ejecutó con exito.", "Ejecución correcta", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error en la conexion o ejecucion: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            con.SqlCloseConection();
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["ID"];

            ConectionDB conection = new ConectionDB();
            //DrowDowList Obra
            string    sqlQuery = "SELECT [idObra],[nombre] FROM [dbo].[Obra]";
            DataTable dt       = conection.GetData(sqlQuery);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow item in dt.Rows)
                {
                    ListItem newItem = new ListItem(item[1].ToString(), item[0].ToString());
                    DD_Obra.Items.Add(newItem);
                }
            }
            dt.Dispose();
            conection.CloseDB();

            //Cateria
            sqlQuery = "SELECT [idCategoria],[descripcion] FROM [dbo].[Categoria]";
            dt       = conection.GetData(sqlQuery);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow item in dt.Rows)
                {
                    ListItem newItem = new ListItem(item[1].ToString(), item[0].ToString());
                    DD_categoria.Items.Add(newItem);
                }
            }
            dt.Dispose();
            conection.CloseDB();
        }
Example #3
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++;
            }
        }
Example #4
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            string      fileName = txtFileName.Text;
            ConectionDB con      = new ConectionDB();

            computerName = con.GetComputerName();
            try
            {
                con.SqlConnect();//ABRIR CONEXION

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con.GetConnection();
                cmd.CommandText = "sp_generar_tmov";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@NOMBRE_DEL_EQUIPO", computerName);
                cmd.Parameters.AddWithValue("@RUTA", folderPath);
                cmd.Parameters.AddWithValue("@NOMBRE", fileName);


                cmd.ExecuteNonQuery();

                cmd.Parameters.Clear();
                txtFileName.Clear();
                MessageBox.Show("Se ejecutó con exito.", "Ejecución correcta", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error en la conexion o ejecucion: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            con.SqlCloseConection();//CERRAR CONEXION
        }
Example #5
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);
         }
     }
 }
Example #6
0
        private void createPrintFile()
        {
            conection = new ConectionDB();
            conection.SqlConnect();

            try
            {
                cmd             = new SqlCommand();
                cmd.Connection  = conection.GetConnection();
                cmd.CommandText = "sp_generar_txt_impresion";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ruta", path);
                cmd.Parameters.AddWithValue("@nombre", fileName);
                cmd.Parameters.AddWithValue("@nombre_del_equipo", machineName);

                cmd.ExecuteNonQuery();

                cmd.Parameters.Clear();
            }
            catch (Exception err)
            {
                MessageBox.Show("No se pudo crear el archivo de texto con los datos del comprobante, " + err.Message);
            }

            conection.SqlCloseConection();
        }
Example #7
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)));
            }
        }
Example #8
0
        private void pb_Click(object sender, EventArgs e)
        {
            int         idRoomImages = Convert.ToInt32(ConectionDB.ReturnResultLikeString(String.Format("select images_id from rooms_images where rooms_id = {0} and images_path = '{1}'", id, listOfStr[Convert.ToInt32((sender as PictureBox).Name)])));
            int         y            = globalPBList.IndexOf(sender as PictureBox);
            PictureForm pf           = new PictureForm(idRoomImages, (RoomChangeForm)Application.OpenForms[this.Name], false, y);

            pf.ShowDialog();
        }
Example #9
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");
     }
 }
Example #10
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));
 
           }
       }
 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();
 }
Example #12
0
 private void cmServices_DropDownClosed(object sender, EventArgs e)
 {
     if (isNew)
     {
         price        = Convert.ToInt32(ConectionDB.ReturnResultLikeString(String.Format("select price_of_service from services where service_name = '{0}'", (cmServices.Text).ToString())));
         tbPrice.Text = (price * nudAmount.Value).ToString();
         Application.OpenForms["BillForm"].Controls["tbSum"].Text = (priceA + Convert.ToInt32(tbPrice.Text.ToString())).ToString();
     }
 }
Example #13
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();
 }
Example #14
0
 public TypeRoom(int _id, MainForm _owner)
 {
     InitializeComponent();
     owner = _owner;
     id    = _id;
     if (id != 0)
     {
         cmType.Text  = ConectionDB.ReturnResultLikeString(String.Format("select type_of_number.type from type_of_number where type_id = {0}", id));
         tbPrice.Text = ConectionDB.ReturnResultLikeString(String.Format("select price from type_of_number where type_id = {0}", id));
     }
 }
 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;
 }
Example #16
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) + ")");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["ID"];

            ConectionDB conection = new ConectionDB();

            //Drop_list de Propietarios
            string    sqlQuery = "SELECT idPropietario, CONCAT(nombre,' ', apellido) AS Nombre FROM [dbo].[Propietario]";
            DataTable dt       = conection.GetData(sqlQuery);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow item in dt.Rows)
                {
                    ListItem newItem = new ListItem(item[1].ToString(), item[0].ToString());
                    DD_Propietario.Items.Add(newItem);
                }
            }
            dt.Dispose();

            //Drop_list de Encargados
            string sqlQuery2 = "SELECT idUsuario, CONCAT(nombre,' ', apellido) AS Nombre FROM [dbo].[Usuario]";

            dt = conection.GetData(sqlQuery2);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow item1 in dt.Rows)
                {
                    ListItem newItem1 = new ListItem(item1[1].ToString(), item1[0].ToString());
                    DD_Encargado.Items.Add(newItem1);
                }
            }
            dt.Dispose();

            if (!String.IsNullOrEmpty(id))
            {
                //Drop_list de Propietarios
                sqlQuery = "SELECT * FROM [dbo].[Obra] where idObra = " + id;
                dt       = conection.GetData(sqlQuery);
                DataRow dr = dt.Rows[0];
                //llenadmos el formulario con los datos actuales
                ID_obra.Value = dr[0].ToString();
                DD_Encargado.SelectedValue   = dr[2].ToString();
                DD_Propietario.SelectedValue = dr[1].ToString();
                nombre_txt.Value             = dr[3].ToString();
                Txt_Direccion.Value          = dr[4].ToString();

                dt.Dispose();
            }

            conection.CloseDB();
        }
Example #18
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;
        }
Example #19
0
 public ServicesForm(int _id, MainForm _owner)
 {
     InitializeComponent();
     id          = _id;
     owner       = _owner;
     label7.Text = "Изменить";
     if (id != 0)
     {
         tbName.Text  = ConectionDB.ReturnResultLikeString(String.Format("select service_name from services where service_id = {0}", id));
         tbPrice.Text = ConectionDB.ReturnResultLikeString(String.Format("select price_of_service from services where service_id = {0}", id));
     }
     isNew = false;
 }
Example #20
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());
                }
            }
        }
Example #21
0
        private string GetQueryLikeStringAnd(CheckedListBox _object)
        {
            string        r             = "";
            List <string> listOfAnswers = new List <string>();
            string        finalString   = "and room_id in (select room_id from rooms_services group by room_id having";

            foreach (var item in _object.CheckedItems)
            {
                listOfAnswers.Add(((DataRowView)item)[1].ToString());
                r            = ConectionDB.ReturnResultLikeString("select service_id from list_of_free_services where name_services = '" + listOfAnswers.Last() + "'");
                finalString += " sum(case when service_id = " + Convert.ToInt32(r) + " then 1 else 0 end)>0 and";
            }
            finalString  = finalString.Remove(finalString.Length - 4);
            finalString += ")";
            return(finalString);
        }
Example #22
0
 public ClientsChangeForm(int _id, MainForm _owner)
 {
     id        = _id;
     newClient = false;
     owner     = _owner;
     InitializeComponent();
     if (id != 0)
     {
         tbSurname.Text   = ConectionDB.ReturnResultLikeString(String.Format("select surname from clients where clients_id = {0}", id));
         tbFirstName.Text = ConectionDB.ReturnResultLikeString(String.Format("select first_name from clients where clients_id = {0}", id));
         tbLastName.Text  = ConectionDB.ReturnResultLikeString(String.Format("select last_name from clients where clients_id = {0}", id));
         rtbIdentify.Text = ConectionDB.ReturnResultLikeString(String.Format("select identify from clients where clients_id = {0}", id));
         tbEmail.Text     = ConectionDB.ReturnResultLikeString(String.Format("select email from clients where clients_id = {0}", id));
         tbPhone.Text     = ConectionDB.ReturnResultLikeString(String.Format("select phone from clients where clients_id = {0}", id));
     }
 }
Example #23
0
        public void FillField(int id)
        {
            tbClient.Text = ConectionDB.ReturnResultLikeString(String.Format("select surname from clients where clients_id = (select clients_id from final_bill where final_bill_id = {0})", id))  + " " + ConectionDB.ReturnResultLikeString(String.Format("select first_name from clients where clients_id = (select clients_id from final_bill where final_bill_id = {0})", id));
            tbDays.Text = ConectionDB.ReturnResultLikeString(String.Format("select number_of_days from final_bill where final_bill_id = {0}", id));
            tbRoom.Text = ConectionDB.ReturnResultLikeString(String.Format("select number_of_room from hotel_room where room_id = (select room_id from final_bill where final_bill_id = {0})", id));
            tbSum.Text = ConectionDB.ReturnResultLikeString(String.Format("select final_summa from final_bill where final_bill_id = {0}", id));
            if (Convert.ToInt32((ConectionDB.ReturnResultLikeString(String.Format("select count(*) from bill where main_bill_id = {0}", id)))) > 0)
            {
                DataTable result = ConectionDB.ReturnResult(String.Format("select bill_id from bill where main_bill_id={0}", id));

                foreach (DataRow item in result.Rows)
                {
                    flpServces.Controls.Add(new AddServices(Convert.ToInt32(item[0]), false));
                }
            }
        }
Example #24
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++;
            }
        }
        private void ShowImages()
        {
            string        appPath   = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\";
            List <string> listOfStr = new List <string>();
            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.SizeMode = PictureBoxSizeMode.Zoom;
                pb.Image    = new Bitmap(appPath + listOfStr.Last());
                flpPicturesBox.Controls.Add(pb);
                pb.Click += new EventHandler(pb_Click);
            }
        }
Example #26
0
        private void btnSendProjection_Click(object sender, EventArgs e)
        {
            string parameter = txtProjection.Text;

            if (parameter != "")
            {
                ConectionDB con = new ConectionDB();
                try
                {
                    con.SqlConnect();

                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection  = con.GetConnection();
                    cmd.CommandText = "sp_aplica_proyeccion";
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@PROYECCION", parameter);
                    cmd.ExecuteNonQuery();

                    cmd.Parameters.Clear();
                    txtProjection.Clear();
                    MessageBox.Show("Se ejecutó con exito.", "Ejecución correcta", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    double LabelX = (this.Location.X) * 0.8;
                    double LabelY = (this.Location.Y) * 0.2;
                    Label  err    = new Label();
                    err.Text      = "No se pudo ejecutar correctamente: " + ex.Message;
                    err.Visible   = true;
                    err.ForeColor = Color.Red;
                    err.Location  = new Point(Convert.ToInt32(LabelX), Convert.ToInt32(LabelY));
                }


                con.SqlCloseConection();
            }
            else
            {
                MessageBox.Show("El campo es obligatorio", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #27
0
        private void getPrinterName()
        {
            conn = new ConectionDB();
            try
            {
                conn.SqlConnect();
                cmd             = new SqlCommand();
                cmd.Connection  = conn.GetConnection();
                cmd.CommandText = selectPrint;
                cmd.CommandType = CommandType.Text;

                SqlDataReader reader = cmd.ExecuteReader();
            }
            catch (Exception err)
            {
                MessageBox.Show("Error: " + err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            conn.SqlCloseConection();
        }
Example #28
0
        private void insertPrinterName()
        {
            conn = new ConectionDB();
            try
            {
                conn.SqlConnect();
                cmd             = new SqlCommand();
                cmd.Connection  = conn.GetConnection();
                cmd.CommandText = "DELETE FROM " + tblName + "\nINSERT INTO " + tblName + " VALUES ('" + Printers.Text + "')";
                cmd.CommandType = CommandType.Text;

                var reader = cmd.ExecuteReader();
            }
            catch (Exception err)
            {
                MessageBox.Show("Error: " + err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            conn.SqlCloseConection();
        }
Example #29
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("Заполните все данные", "Ошибка");
            }
        }
Example #30
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);
        }