/// <summary> /// /// </summary> /// <param name="objEntrada"></param> public void RegistroRepairSMDPrincipal(Model_EntradaSMD objEntrada) { try { OpenConnection(); string strInsert = string.Format(@"INSERT INTO dbo.PrincipalProcessRepair VALUES(@data,@hora,@cod,NULL, NULL,'',NULL,NULL, NULL,'N/A',NULL, '','',NULL,NULL,@user,'','WAITING','','','','SMD','0','0')"); using (cmd = new SqlCommand(strInsert, conn)) { string data = DateTime.Now.ToString("yyyy/MM/dd"); string hora = DateTime.Now.ToString("HH:mm:ss"); cmd.Parameters.AddWithValue("@data", data); cmd.Parameters.AddWithValue("@hora", hora); cmd.Parameters.AddWithValue("@cod", objEntrada.EntradaId); cmd.Parameters.AddWithValue("@user", objEntrada.UserName); cmd.ExecuteNonQuery(); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { ClosedConnection(); } }
public Model_EntradaSMD GetCodPai() { try { OpenConnection(); string strSelect = string.Format(@"SELECT TOP(1)CodReparoMain FROM EntradaRepairMain ORDER BY CodReparoMain DESC"); using (cmd = new SqlCommand(strSelect, conn)) { using (Dr = cmd.ExecuteReader()) { Model_EntradaSMD objModel = null; while (Dr.Read()) { objModel = new Model_EntradaSMD(); objModel.EntradaId = Convert.ToInt32(Dr[0]); } return(objModel); } } } catch (SqlException ex) { throw new Exception(ex.Message); } finally { ClosedConnection(); } }
public void RegistroRepairSMD(Model_EntradaSMD objEntrada) { try { OpenConnection(); string strInsert = string.Format(@"INSERT INTO dbo.EntradaRepairMain VALUES(@data,@hora,NULL,@model,@falhas,@line,NULL,@cn,@user,@tec,'SMD')"); using (cmd = new SqlCommand(strInsert, conn)) { string data = DateTime.Now.ToString("yyyy/MM/dd"); string hora = DateTime.Now.ToString("HH:mm:ss"); cmd.Parameters.AddWithValue("@data", data); cmd.Parameters.AddWithValue("@hora", hora); cmd.Parameters.AddWithValue("@model", objEntrada.Model); cmd.Parameters.AddWithValue("@falhas", objEntrada.Falhas); cmd.Parameters.AddWithValue("@line", objEntrada.Line); cmd.Parameters.AddWithValue("@cn", objEntrada.CN); cmd.Parameters.AddWithValue("@user", objEntrada.UserName); cmd.Parameters.AddWithValue("@tec", objEntrada.TecnicoSMD); cmd.ExecuteNonQuery(); } } catch (Exception ex) { throw new Exception("Error to Insert: " + ex.Message); } finally { ClosedConnection(); } }
protected void btnSalve_Click(object sender, EventArgs e) { foreach (GridViewRow row in GridView1.Rows) { if (((CheckBox)row.FindControl("ckeckBoxInsert")).Checked) { string EntradaId = ((Label)row.FindControl("lblCodigo")).Text; Model_EntradaSMD objModel = new Model_EntradaSMD(); objModel.EntradaId = Convert.ToInt32(EntradaId); objModel.UserName = ddlTec.SelectedValue; Class_SMD_Board_Plus_Tecnico add = new Class_SMD_Board_Plus_Tecnico(); if (ddlTec.SelectedItem.Text != "ALL") { add.RegistrarTecnicoComBoard(objModel); add.UpdateStatus(objModel); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Relacionamento feito com sucesso');", true); } else { add.RegistrarTecnicoComBoardNUll(objModel); add.UpdateStatusNull(objModel); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Relacionamento feito com sucesso');", true); } ListaAll(); getTec(); } } }
public void RegistrarTecnicoComBoardNUll(Model_EntradaSMD mod) { try { OpenConnection(); string str = string.Format(@"INSERT INTO TecnicoMaisPlaca VALUES(@data,@cod,NULL,@alocado)"); using (cmd = new SqlCommand(str, conn)) { string data = DateTime.Now.ToString("yyyy/MM/dd"); bool alocada = true; cmd.Parameters.AddWithValue("@data", data); cmd.Parameters.AddWithValue("@cod", mod.EntradaId); cmd.Parameters.AddWithValue("@alocado", alocada); cmd.ExecuteNonQuery(); } } catch (SqlException ex) { throw new Exception("Erro ao registrar o tecnico + placa" + ex.Message); } finally { ClosedConnection(); } }
/// <summary> /// /// </summary> public void getCodPai() { try { objModel = list.GetCodPai(); if (objModel != null) { lblCodPai.Text = Convert.ToString(objModel.EntradaId); } else { lblMsg.Text = "Nunhum codigo retornado!"; } } catch (Exception ex) { lblMsg.Text = "Error ao recuperar o Codigo: " + ex.Message; } }
/// <summary> /// /// </summary> /// <param name="mod"></param> public void UpdateStatus(Model_EntradaSMD mod) { try { OpenConnection(); string str = string.Format(@"UPDATE PrincipalProcessRepair SET Status='TRANSFER TEC' WHERE EntradaId = @cod"); using (cmd = new SqlCommand(str, conn)) { cmd.Parameters.AddWithValue("@cod", mod.EntradaId); cmd.ExecuteNonQuery(); } } catch (SqlException ex) { throw new Exception("Erro ao atualizar os Status: " + ex.Message); } finally { ClosedConnection(); } }