Example #1
0
 public void BuscarCodigo()
 {
     try
     {
         _serv = new LServicios {
             Codigo = int.Parse(TxtItem.Text)
         };
         var res = _serv.Buscar(_serv);
         if (res == null)
         {
             return;
         }
         TxtItem.Enabled       = false;
         TxtNombre.Text        = res.Rows[0][1].ToString();
         CbxTipo.SelectedItem  = res.Rows[0][2].ToString();
         TxtValorUni.Text      = res.Rows[0][3].ToString();
         TxtObservaciones.Text = res.Rows[0][4].ToString();
         BtnModificar.Enabled  = true;
         BtnGuardar.Enabled    = false;
         Habilitar();
         GridViewServicios.DataSource = res;
     }
     catch (Exception)
     {
         MessageBox.Show("Servicio no Existe ", "SmartPrint", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         Inhabilitar();
         BtnGuardar.Enabled = false;
         TxtItem.Enabled    = true;
         TxtItem.Clear();
     }
 }
Example #2
0
 private void pictureBox3_Click(object sender, EventArgs e)
 {
     TxtNombre.Clear();
     CbxTipo.SelectedItem = (null);
     TxtObservaciones.Clear();
     TxtValorUni.Clear();
     TxtItem.Enabled = true;
     TxtItem.Clear();
     Inhabilitar();
     bnBuscarItem.Visible         = false;
     GridViewServicios.DataSource = null;
 }
        private void buttonSearchPD_Click(object sender, EventArgs e)
        {
            try
            {
                // timer2.Enabled = false;



                //SqlConnection SQL_connectionStr;

                //SQL_connectionStr = new SqlConnection(strConnString);
                //SQL_connectionStr.Open();
                conn.Open();

                SqlCommand CmdSQLST = conn.CreateCommand();
                CmdSQLST.CommandText = "EXEC YSS_CAL_WARRANTY '" + comboBoxPD.Text + "','" + ConfigurationManager.ConnectionStrings["yss_department"].ConnectionString + "'";
                CmdSQLST.ExecuteNonQuery();

                SqlCommand CmdSQL = conn.CreateCommand();

                DataTable table_Not = new DataTable("YSS_WARRANTY_SERIAL");
                //table_Not.Columns.Add("ITEMID", typeof(String));
                table_Not.Columns.Add("MARKINGCODE1", typeof(String));
                table_Not.Columns.Add("MARKINGCODE2", typeof(String));
                table_Not.Columns.Add("UNIT", typeof(String));
                table_Not.Columns.Add("LS_MODEL", typeof(String));
                table_Not.Columns.Add("LS_LOCATION", typeof(String));
                table_Not.Columns.Add("DEPARTMENT", typeof(String));
                table_Not.Columns.Add("DATE_PRINT", typeof(DateTime));



                TxtItem.Clear();

                CmdSQL.CommandText = "SELECT ITEMID, MARKINGCODE1, MARKINGCODE2, DEPARTMENT, UNIT, LS_MODEL, LS_LOCATION,NAME,DATE_PRINT FROM YSS_WARRANTY_SERIAL WHERE DATE_PRINT = '1900-01-01 00:00:00.000'  and PRODID = '" + comboBoxPD.Text + "' and DEPARTMENT = '" + ConfigurationManager.ConnectionStrings["yss_department"].ConnectionString + "'"; // and SALESID = 'SO17025611'";
                SqlDataReader ReaderSQL = CmdSQL.ExecuteReader();
                while (ReaderSQL.Read())
                {
                    if (TxtItem.Text == "")
                    {
                        TxtItem.Text = ReaderSQL.GetString(0) + "-" + ReaderSQL.GetString(7);
                    }
                    DataRow newRow = table_Not.NewRow();
                    //newRow["ITEMID"] = ReaderSQL.GetString(0);
                    newRow["MARKINGCODE1"] = ReaderSQL.GetString(1);
                    newRow["MARKINGCODE2"] = ReaderSQL.GetString(2);
                    newRow["UNIT"]         = ReaderSQL.GetString(4);
                    newRow["LS_MODEL"]     = ReaderSQL.GetString(5);
                    newRow["LS_LOCATION"]  = ReaderSQL.GetString(6);
                    newRow["DEPARTMENT"]   = ReaderSQL.GetString(3);
                    newRow["DATE_PRINT"]   = ReaderSQL.GetDateTime(8);

                    table_Not.Rows.Add(newRow);
                }
                ReaderSQL.Close();
                this.dataGridView1.AutoGenerateColumns = true;
                this.dataGridView1.DataSource          = table_Not;
                dataGridView1.ReadOnly = false;
                //dataGridView1.Columns["ITEMID"].ReadOnly = true;
                dataGridView1.Columns["MARKINGCODE1"].ReadOnly = true;
                dataGridView1.Columns["MARKINGCODE2"].ReadOnly = true;
                dataGridView1.Columns["UNIT"].ReadOnly         = true;
                dataGridView1.Columns["LS_MODEL"].ReadOnly     = true;
                dataGridView1.Columns["LS_LOCATION"].ReadOnly  = true;
                dataGridView1.Columns["DEPARTMENT"].ReadOnly   = true;
                dataGridView1.Columns["DATE_PRINT"].ReadOnly   = true;



                //this.ITEMIDDataGridViewTextBoxColumn.ReadOnly(true);


                //                timer2.Enabled = true;



                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show(ex.Message);
                conn.Close();
                // timer2.Enabled = true;
                // DynAx.Logoff();
            }
        }