public List <XOficina> mostrar_Oficinas(string region, string conexionF) { List <XOficina> l = new List <XOficina>(); //string connString = "Data Source=DESKTOP-LS14HCO;Initial Catalog=DT2021;Integrated Security=True"; //string connString = "Data Source=DESKTOP-8CV6UC2;Initial Catalog=DT4333;Integrated Security=True"; using (SqlConnection myConn = new SqlConnection(conexionF)) { try { myConn.Open(); var mycmd = myConn.CreateCommand(); mycmd.CommandText = "Execute SP_DameOficinas @Region"; mycmd.Parameters.Add("@Region", SqlDbType.Int, 150).Value = Convert.ToInt16(region); SqlDataReader rdr = mycmd.ExecuteReader(); while (rdr.Read()) { XOficina f = new XOficina() { id_Oficina = rdr["id_Oficina"].ToString(), nombre_Oficina = rdr["nombre_Oficina"].ToString() }; l.Add(f); } } catch (Exception EX) { EX.GetBaseException(); } finally { myConn.Close(); } return(l); } }
// public int creamdata(MCreamProduction receive) { int result = 0; try { DBParameterCollection paramcollection = new DBParameterCollection(); paramcollection.Add(new DBParameter("@RMRId", receive.RMRId)); paramcollection.Add(new DBParameter("@CreamProductionId", receive.CreamProductionId)); paramcollection.Add(new DBParameter("@CreamProductionDate", receive.CreamProductionDate)); paramcollection.Add(new DBParameter("@CreamProductionShiftId", receive.CreamProductionShiftId)); paramcollection.Add(new DBParameter("@BatchCodeCream", receive.BatchCodeCream)); paramcollection.Add(new DBParameter("@FAT", receive.FAT)); paramcollection.Add(new DBParameter("@CreamQty", receive.CreamQty)); paramcollection.Add(new DBParameter("@CreamStatusId", receive.CreamStatusId)); paramcollection.Add(new DBParameter("@flag", receive.flag)); result = _DBHelper.ExecuteNonQuery("sp_Prod_CreamProductionDetails", paramcollection, CommandType.StoredProcedure); } catch (Exception EX) { string MSG = EX.ToString(); } return(result); }
private String GETMAXID() { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT MAX(supplier_id) FROM supplier", CONNECTION.CON)) { DataTable DT = new DataTable(); DA.Fill(DT); if (DT.Rows.Count > 0) { return(DT.Rows[0].Field <int>(0).ToString()); } else { return("0"); } } } catch (Exception EX) { return(EX.ToString()); } }
public static CarsType ReturnCarType(int carsTypeID) { try { using (RentalcarsEntities1 ef = new RentalcarsEntities1()) { CarsType isExist = ef.CarsTypes.FirstOrDefault(u => u.CarTypeID == carsTypeID); if (isExist != null) { CarsType carType = isExist; return(carType); } else { throw new InvalidOperationException($"this car type is not exist please change the values and try again"); } } } catch (Exception EX) { throw new Exception(EX.ToString()); } }
public int execute(string sql) { int durum = 0; try { NpgsqlCommand com = new NpgsqlCommand(sql, connect_get()); if (ExecParameters.Count > 0) { for (int i = 0; i < ExecParameters.Count; i++) { com.Parameters.Add(ExecParameters[i]); } } durum = com.ExecuteNonQuery(); ExecParameters.Clear(); } catch (Exception EX) { dbcon.Log.Logwrite("ExecuteMetod=" + EX.ToString() + " Sql=" + sql); } return(durum); }
// public int pastdata(MPastProcess receive) { int result = 0; try { DBParameterCollection paramcollection = new DBParameterCollection(); paramcollection.Add(new DBParameter("@RMRId", receive.RMRId)); paramcollection.Add(new DBParameter("@StdId", receive.StdId)); paramcollection.Add(new DBParameter("@pastProcessId", receive.pastProcessId)); paramcollection.Add(new DBParameter("@PastProcessDate", receive.PastProcessDate)); paramcollection.Add(new DBParameter("@PastShiftId", receive.PastShiftId)); paramcollection.Add(new DBParameter("@IBTTemperature", receive.IBTTemperature)); paramcollection.Add(new DBParameter("@PastStartTime", receive.PastStartTime)); paramcollection.Add(new DBParameter("@PastTempHeat1", receive.PastTempHeat1)); paramcollection.Add(new DBParameter("@Cool1", receive.Cool1)); paramcollection.Add(new DBParameter("@PastTempHeat2", receive.PastTempHeat2)); paramcollection.Add(new DBParameter("@Cool2", receive.Cool2)); paramcollection.Add(new DBParameter("@PastTempHeat3", receive.PastTempHeat3)); paramcollection.Add(new DBParameter("@Cool3", receive.Cool3)); paramcollection.Add(new DBParameter("@PastTempHeat4", receive.PastTempHeat4)); paramcollection.Add(new DBParameter("@Cool4", receive.Cool4)); paramcollection.Add(new DBParameter("@PastTempHeat5", receive.PastTempHeat5)); paramcollection.Add(new DBParameter("@Cool5", receive.Cool5)); paramcollection.Add(new DBParameter("@MilkClosingTime", receive.MilkClosingTime)); paramcollection.Add(new DBParameter("@DoneBy", receive.DoneBy)); paramcollection.Add(new DataAcess.DBParameter("@PastProcessStatusId", receive.pastProcessStatusId)); paramcollection.Add(new DBParameter("@flag", receive.flag)); result = _DBHelper.ExecuteNonQuery("sp_Prod_PasteurizationProcessDetails", paramcollection, CommandType.StoredProcedure); } catch (Exception EX) { string MSG = EX.ToString(); } return(result); }
public static String GET_MAX_INT_ID(String QRY) { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter(QRY, CONNECTION.CON)) { DataTable DT = new DataTable(); DA.Fill(DT); if (DT.Rows.Count > 0) { return(DT.Rows[0].Field <int>(0).ToString()); } else { return("0"); } } } catch (Exception EX) { return(EX.ToString()); } }
//public string connString = "Data Source=DESKTOP-LS14HCO;Initial Catalog=DT2021;Integrated Security=True"; // public string connString = "Data Source=DESKTOP-8CV6UC2;Initial Catalog=DT4333;Integrated Security=True"; public string agregar_seguro(string nombreseguro, string empresaseguro, string telefonoseguro, string correoseguro, string direccionseguro, string descripcionseguro, string conexionF) { string mensaje = ""; using (SqlConnection myConn = new SqlConnection(conexionF)) { try { myConn.Open(); var mycmd = myConn.CreateCommand(); mycmd.CommandText = "Execute SP_IngresaSeguro @nombreseguro, @empresaseguro, @telefonoseguro, @correoseguro, @direccionseguro, @descripcionseguro"; mycmd.Parameters.Add("@nombreseguro", SqlDbType.VarChar, 150).Value = nombreseguro; mycmd.Parameters.Add("@empresaseguro", SqlDbType.VarChar, 150).Value = empresaseguro; mycmd.Parameters.Add("@telefonoseguro", SqlDbType.VarChar, 150).Value = telefonoseguro; mycmd.Parameters.Add("@correoseguro", SqlDbType.VarChar, 150).Value = correoseguro; mycmd.Parameters.Add("@direccionseguro", SqlDbType.VarChar, 150).Value = direccionseguro; mycmd.Parameters.Add("@descripcionseguro", SqlDbType.VarChar, 150).Value = descripcionseguro; SqlDataReader rdr = mycmd.ExecuteReader(); while (rdr.Read()) { mensaje = rdr["Mensaje"].ToString(); //reto codigo } } catch (Exception EX) { EX.GetBaseException(); } finally { myConn.Close(); } } return(mensaje); }
public List <DelUser> mostrartodo(string conexionF) { List <DelUser> l = new List <DelUser>(); using (SqlConnection myConn = new SqlConnection(conexionF)) { try { myConn.Open(); var mycmd = myConn.CreateCommand(); mycmd.CommandText = "Execute SP_CargaUserOcultar"; SqlDataReader rdr = mycmd.ExecuteReader(); while (rdr.Read()) { DelUser d = new DelUser() { id_Usuario = rdr["id_Usuario"].ToString(), nombre_Usuario = rdr["nombre_Usuario"].ToString(), }; l.Add(d); } } catch (Exception EX) { EX.GetBaseException(); } finally { myConn.Close(); } } return(l); }
// public string connString = "Data Source=DESKTOP-LS14HCO;Initial Catalog=DT2021;Integrated Security=True"; public List <Descripcion> mostrardescripcion(string usuario, string conexionF) { List <Descripcion> pro = new List <Descripcion>(); using (SqlConnection myConn = new SqlConnection(conexionF)) { try { myConn.Open(); var mycmd = myConn.CreateCommand(); mycmd.CommandText = "Execute SP_FiltraActivos @id"; mycmd.Parameters.Add("@id", SqlDbType.Int, 150).Value = Convert.ToInt16(usuario); SqlDataReader rdr = mycmd.ExecuteReader(); while (rdr.Read()) { Descripcion p = new Descripcion() { placa_Activo = rdr["placa_Activo"].ToString(), descripcion = rdr["descripcion"].ToString(), Mensaje = rdr["Mensaje"].ToString(), }; pro.Add(p); //reto codigo } } catch (Exception EX) { EX.GetBaseException(); } finally { myConn.Close(); } } return(pro); }
public fcproduc_Info get_info_ProductoNexp(string Codigo) { try { fcproduc_Info info = new fcproduc_Info(); using (EntitiesNexpirion Context = new EntitiesNexpirion()) { Context.SetCommandTimeOut(3000); fcproduc Entity = Context.fcproduc.Where(q => q.codigo.ToString().Trim() == Codigo).FirstOrDefault(); if (Entity == null) { return(null); } info = new fcproduc_Info { codigo = Entity.codigo, nombre = Entity.nombre, tipoitm = Entity.tipoitm, peso = Entity.peso }; } return(info); } catch (Exception EX) { data_log.GuardarDB(new LogError_Info { Controlador = "Producto_Data", Error = "Error: " + EX.ToString() + " " + string.Format("get_info_ProductoNexp: {0}", JsonConvert.SerializeObject(new { Codigo = Codigo })), IdUsuario = "" }); return(null); } }
// public string connString = "Data Source=DESKTOP-LS14HCO;Initial Catalog=DT2021;Integrated Security=True"; public List <Poliza> mostrarpolizas(string conexionF) { List <Poliza> pro = new List <Poliza>(); using (SqlConnection myConn = new SqlConnection(conexionF)) { try { myConn.Open(); var mycmd = myConn.CreateCommand(); mycmd.CommandText = "Execute SP_Polizas"; SqlDataReader rdr = mycmd.ExecuteReader(); while (rdr.Read()) { Poliza p = new Poliza() { id_aseguramiento = rdr["id_aseguramiento"].ToString(), nombre_seguro = rdr["nombre_seguro"].ToString() }; pro.Add(p); } } catch (Exception EX) { EX.GetBaseException(); } finally { myConn.Close(); } } return(pro); }
// public int machinereportdata(MMachineComplaintsAndRectifiedRecord receive) { int result = 0; try { DBParameterCollection paramcollection = new DBParameterCollection(); paramcollection.Add(new DBParameter("@MachineComplaintsAndRectifiedRecordId", receive.MachineComplaintsAndRectifiedRecordId)); paramcollection.Add(new DBParameter("@MachineComplaintsAndRectifiedRecordDate", receive.MachineComplaintsAndRectifiedRecordDate)); paramcollection.Add(new DBParameter("@MachineComplaintsAndRectifiedRecordShiftId", receive.MachineComplaintsAndRectifiedRecordShiftId)); paramcollection.Add(new DBParameter("@MachineName", receive.MachineName)); paramcollection.Add(new DBParameter("@IdentifiedBy", receive.IdentifiedBy)); paramcollection.Add(new DBParameter("@RectifiedBy", receive.RectifiedBy)); paramcollection.Add(new DBParameter("@RectifiedDate", receive.RectifiedDate)); paramcollection.Add(new DBParameter("@MachineRectifiedStatus", receive.MachineRectifiedStatus)); paramcollection.Add(new DBParameter("@flag", receive.flag)); result = _DBHelper.ExecuteNonQuery("prod_spMachineComplaintsAndRectifiedDetails", paramcollection, CommandType.StoredProcedure); } catch (Exception EX) { String MSG = EX.ToString(); } return(result); }
// public string connString = "Data Source=DESKTOP-LS14HCO;Initial Catalog=DT2021;Integrated Security=True"; // public string connString = "Data Source=DESKTOP-8CV6UC2;Initial Catalog=DT4333;Integrated Security=True"; public string agregaroficina(int esbodega, string nombreoficina, string coordinadoroficina, string telefonooficina, string correooficina, string direccionofi, string observaciones, int idregion, string conexionF) { string mensaje = ""; using (SqlConnection myConn = new SqlConnection(conexionF)) { try { myConn.Open(); var mycmd = myConn.CreateCommand(); mycmd.CommandText = "Execute SP_IngresarOficina @esbodega, @nombreoficina, @coordinadoroficina, @telefonooficina, @correooficina,@direccion,@observaciones,@idregion"; mycmd.Parameters.Add("@esbodega", SqlDbType.Int, 150).Value = esbodega; mycmd.Parameters.Add("@nombreoficina", SqlDbType.VarChar, 150).Value = nombreoficina; mycmd.Parameters.Add("@coordinadoroficina", SqlDbType.VarChar, 150).Value = coordinadoroficina; mycmd.Parameters.Add("@telefonooficina", SqlDbType.VarChar, 150).Value = telefonooficina; mycmd.Parameters.Add("@correooficina", SqlDbType.VarChar, 150).Value = correooficina; mycmd.Parameters.Add("@direccion", SqlDbType.VarChar, 150).Value = direccionofi; mycmd.Parameters.Add("@observaciones", SqlDbType.VarChar, 150).Value = observaciones; mycmd.Parameters.Add("@idregion", SqlDbType.Int, 150).Value = idregion; SqlDataReader rdr = mycmd.ExecuteReader(); while (rdr.Read()) { mensaje = rdr["Mensaje"].ToString(); //reto codigo } } catch (Exception EX) { EX.GetBaseException(); } finally { myConn.Close(); } } return(mensaje); }
public void LoadCompanyDropDown() { JKS.Approval objApproval = new JKS.Approval(); DataSet ds = new DataSet(); try { ds = objApproval.GetCompanyDropDownGeneric(System.Convert.ToInt32(Session["CompanyID"])); ddlCompany.DataSource = ds; ddlCompany.DataBind(); ddlCompany.DataTextField = "CompanyName"; ddlCompany.DataValueField = "CompanyID"; } catch (Exception EX) { EX.ToString(); } finally { ds = null; ddlCompany.Items.Insert(0, new ListItem("Select Company", "0")); //objApproval.Dispose(); } }
private void lvConjuntos_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (lvConjuntos.SelectedItems.Count == 1) { try { Conjuntos conjunto_selected = (Conjuntos)lvConjuntos.SelectedItems[0].Tag as Conjuntos; conjunto = conjunto_selected.nombre; SetName(); setDetails(Global.DIRECTORIO_IMAGENES + @"\" + conjunto_selected.image_path, conjunto_selected.nombre, tipos.Conjunto); tlpDetalles.Visible = true; } catch (Exception EX) { MessageBox.Show("error: " + EX.ToString()); } } else { tlpDetalles.Visible = false; } }
static void Main() { Mutex mutex = new Mutex(false, Assembly.GetExecutingAssembly().ManifestModule.Name); try { if (mutex.WaitOne(0, false)) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new LoginForm(Assembly.GetExecutingAssembly().ManifestModule.Name, Properties.Settings.Default.ApplicationTypeName, Assembly.GetExecutingAssembly().GetName().Name, true)); } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } finally { mutex.Close(); } }
// public string connString = "Data Source=DESKTOP-LS14HCO;Initial Catalog=DT2021;Integrated Security=True"; public string intentalo(string funcionariorg, string activosrg, string ipequipo, int user, string _numboletaAsigna, string conexionF) { string mensaje = ""; using (SqlConnection myConn = new SqlConnection(conexionF)) { try { myConn.Open(); var mycmd = myConn.CreateCommand(); mycmd.CommandText = "Execute SP_AsignaActivos @num_boleta,@id_Funcionario, @id_Activo, @id_Usuario, @ip"; mycmd.Parameters.Add("@num_boleta", SqlDbType.VarChar, 150).Value = _numboletaAsigna; mycmd.Parameters.Add("@id_Funcionario", SqlDbType.Int, 150).Value = Convert.ToInt32(funcionariorg); mycmd.Parameters.Add("@id_Activo", SqlDbType.Int, 150).Value = Convert.ToInt32(activosrg); mycmd.Parameters.Add("@id_Usuario", SqlDbType.Int, 150).Value = user; mycmd.Parameters.Add("@ip", SqlDbType.Int, 150).Value = ipequipo; SqlDataReader rdr = mycmd.ExecuteReader(); while (rdr.Read()) { mensaje = rdr["Mensaje"].ToString(); //reto codigo } } catch (Exception EX) { EX.GetBaseException(); } finally { myConn.Close(); } } return(mensaje); }
public ObjectId CreateMyTablesytle() //创建表格样式 { //Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; //Database db = Application.DocumentManager.MdiActiveDocument.Database; const string stylename = "GCLCurveElementsTableStyle"; ObjectId tsId = ObjectId.Null; using (Transaction trans = db.TransactionManager.StartTransaction()) { try { DBDictionary sd = (DBDictionary)trans.GetObject(db.TableStyleDictionaryId, OpenMode.ForRead); if (sd.Contains(stylename)) { tsId = sd.GetAt(stylename); } else { TableStyle ts = new TableStyle(); ts.FlowDirection = FlowDirection.LeftToRight; //这是10版.net的bug? ts.HorizontalCellMargin = 0; ts.VerticalCellMargin = 0; sd.UpgradeOpen(); tsId = sd.SetAt(stylename, ts); trans.AddNewlyCreatedDBObject(ts, true); } trans.Commit(); } catch (Autodesk.AutoCAD.Runtime.Exception EX) { ed.WriteMessage("\n出错了!" + EX.ToString()); } } return(tsId); }
private void ShwBtn_Click(object sender, EventArgs e) { IISmpGenericReport m_ISmpGenericReport; m_ISmpGenericReport = new ISmpGenericReportClass(); string strBContent = "", strBContentName = "", strCRow = "", strCCol = "", strCMRow = "", strCMCol = "", strCAligment = ""; GetAttributeValues(); try { m_ISmpGenericReport.AddReportHeading(Convert.ToInt32(strHRow), Convert.ToInt32(strHCol), Convert.ToInt32(strHMRow), Convert.ToInt32(strHMCol), Header, Convert.ToInt32(StringAlignment.Center), 0); for (int i = 0; i < RsltList.Items.Count; i++) { RsltList.Items[i].Selected = true; if (RsltList.Items[i].Selected == true) { strBContentName = RsltList.Items[i].SubItems[0].Text; strBContent = RsltList.Items[i].SubItems[1].Text; strCRow = RsltList.Items[i].SubItems[2].Text; strCCol = RsltList.Items[i].SubItems[3].Text; strCMRow = RsltList.Items[i].SubItems[4].Text; strCMCol = RsltList.Items[i].SubItems[5].Text; strCAligment = RsltList.Items[i].SubItems[6].Text; } m_ISmpGenericReport.AddBodyContentsEx(Convert.ToInt32(strCRow), Convert.ToInt32(strCCol), strBContentName, Right, 1); m_ISmpGenericReport.AddBodyContentsEx(Convert.ToInt32(strCRow), Convert.ToInt32(strCCol) + 1, strBContent, Right, 1); } m_ISmpGenericReport.AddFooterContents(Convert.ToInt32(strFRow), Convert.ToInt32(strFCol), Convert.ToInt32(strFMRow), Convert.ToInt32(strFMCol), Footer, Convert.ToInt32(StringAlignment.Center), 0); m_ISmpGenericReport.FillReport(); } catch (Exception EX) { MessageBox.Show(EX.ToString()); } }
public static void deleteFrom_db(string ManufacturerName, string Model, string Gear, DateTime ManufactureYear, decimal DailyCost, decimal CostDayOverdue) { try { using (RentalcarsEntities1 ef = new RentalcarsEntities1()) { CarsType isExist = ef.CarsTypes.FirstOrDefault(u => u.ManufacturerName == ManufacturerName && u.ManufactureYear == ManufactureYear && u.Model == Model && u.Gear == Gear && u.DailyCost == DailyCost && u.CostDayOverdue == CostDayOverdue); if (isExist != null) { ef.CarsTypes.Remove(isExist); ef.SaveChanges(); } else { throw new InvalidOperationException($"this car type is not exist please change the values and try again"); } } } catch (Exception EX) { throw new Exception(EX.ToString()); } }
public List <PlazaFuncionario> damedatosfuncionario(string conexionF, string placa) { List <PlazaFuncionario> fun = new List <PlazaFuncionario>(); using (SqlConnection myConn = new SqlConnection(conexionF)) { try { myConn.Open(); var mycmd = myConn.CreateCommand(); mycmd.CommandText = "Execute SP_Cargaid @placa"; mycmd.Parameters.Add("@placa", SqlDbType.VarChar, 150).Value = placa; SqlDataReader rdr = mycmd.ExecuteReader(); while (rdr.Read()) { PlazaFuncionario p = new PlazaFuncionario() { id_Activo = rdr["id_Activo"].ToString(), }; fun.Add(p); //reto codigo } } catch (Exception EX) { EX.GetBaseException(); } finally { myConn.Close(); } } return(fun); }
async Task <long> savenewquantity(long sp_id, SH_PLASTIC_MOLD_DATA mydata) { try { myconnection.openConnection(); SqlCommand cmd = new SqlCommand("SH_SAVE_PLASTIC_MOLD_QUANTITY", DatabaseConnection.mConnection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SH_SPECIFICATION_OF_PLASTIC_MOLD_ID", sp_id); cmd.Parameters.AddWithValue("@SH_SUPPLIER_ID", mydata.supplier.SH_ID); cmd.Parameters.AddWithValue("@SH_SUPPLIER_BRANCH_ID", mydata.supplier_branch.SH_ID); cmd.Parameters.AddWithValue("@SH_ADDITION_DATE", mydata.Addition_date); cmd.Parameters.AddWithValue("@SH_ADDITION_PERMISSION_NUMBER", mydata.addition_permission_number); cmd.Parameters.AddWithValue("@SH_CONTAINER_NAME", mydata.container_name); cmd.Parameters.AddWithValue("@SH_NO_OF_ITEMS_PER_CONTAINER", mydata.no_of_items_per_container); cmd.Parameters.AddWithValue("@SH_NO_OF_CONTAINERS", mydata.no_of_containers); cmd.Parameters.AddWithValue("@SH_TOTAL_NO_ITEMS", mydata.total_number_of_items()); cmd.Parameters.AddWithValue("@SH_STOCK_ID", mydata.stock.SH_ID); cmd.Parameters.AddWithValue("@SH_STOCK_MAN_ID", mydata.stock_man.SH_ID); cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_EMPLOYEE_ID", mEmployee.SH_ID); cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_USER_ID", mAccount.SH_ID); long q_id = 0; SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { q_id = long.Parse(reader["myidentity"].ToString()); } reader.Close(); myconnection.closeConnection(); return(q_id); } catch (Exception EX) { MessageBox.Show("ERROR WHILE ADDING NEW QUANTITY " + EX.ToString()); } return(0); }
public int QualityData(MQuality receive) { int result = 0; try { DBParameterCollection paramcollection = new DBParameterCollection(); //paramcollection.Add(new DBParameter("@QCId", receive.QCId)); paramcollection.Add(new DBParameter("@RMRId", receive.RMRId)); paramcollection.Add(new DBParameter("@QualityDate", receive.QualityDate)); paramcollection.Add(new DBParameter("@RMRShiftId", receive.RMRShiftId)); paramcollection.Add(new DBParameter("@Temperature", receive.Temperature)); paramcollection.Add(new DBParameter("@Alcohol", receive.Alcohol)); paramcollection.Add(new DBParameter("@Neutralizer", receive.Neutralizer)); paramcollection.Add(new DBParameter("@Taste", receive.Taste)); paramcollection.Add(new DBParameter("@Smell", receive.Smell)); paramcollection.Add(new DBParameter("@Color", receive.Color)); paramcollection.Add(new DBParameter("@Acidity", receive.Acidity)); paramcollection.Add(new DBParameter("@HeatStability", receive.HeatStability)); paramcollection.Add(new DBParameter("@Fat", receive.Fat)); paramcollection.Add(new DBParameter("@CLR", receive.CLR)); paramcollection.Add(new DBParameter("@SNF", receive.CLR)); paramcollection.Add(new DBParameter("@TestedBy", receive.TestedBy)); paramcollection.Add(new DBParameter("@VerifiedBy", receive.VerifiedBy)); paramcollection.Add(new DBParameter("@Others", receive.Others)); paramcollection.Add(new DBParameter("@Remarks", receive.Remarks)); paramcollection.Add(new DBParameter("@QCStatus", receive.QCStatus)); paramcollection.Add(new DBParameter("@flag", receive.flag)); result = _DBHelper.ExecuteNonQuery("sp_Prod_QualityDetails", paramcollection, CommandType.StoredProcedure); } catch (Exception EX) { string MSG = EX.ToString(); } return(result); }
public bool InsertSaldosDiarios(SaldosDiarios saldos, string json, ref string mensaje2, ref string codigo) { bool result = false; string vSql = ""; string ruta = ""; //string Dirreccion = System.Configuration.ConfigurationManager.AppSettings["ruta"].ToString(); ; string Direccion = "\\\\pasqui-fs\\EMPRESAS\\SISTEMAS\\WSFILES\\"; try { ruta = Direccion + "BAW" + "\\" + "BITACORA.log"; System.IO.File.AppendAllText(ruta, "--------------------------------------------------------------------------------------------------------------------------------------------- \n"); System.IO.File.AppendAllText(ruta, " Json Resivido: \n"); System.IO.File.AppendAllText(ruta, json + "\n"); System.IO.File.AppendAllText(ruta, "--------------------------------------------------------------------------------------------------------------------------------------------- \n"); System.IO.File.AppendAllText(ruta, "SALDOS DIARIOS POR PROCESAR: " + saldos.ASIENTO + " Hora: " + DateTime.Now.ToString() + "\n"); System.IO.File.AppendAllText(ruta, "CREACION DE ASIENTO (BAW -> ) \n"); vSql = "INSERT INTO INTBAW.INT_SALDOS_DIARIOS ( ASIENTO, COD_COMPANIA, COD_PAIS, CREDITOS_LOCAL, CUENTA_CONTABLE, DEBITO_DOLAR, DEBITO_LOCAL, DESCRIPCION_NIT, DESCRIPCIÓN," + " FECHA, FUENTE, NIT, NOMBRE_COMPANIA, NOMBRE_PAIS, ORIGEN, PAQUETE, REFERENCIA, TIPO_ASIENTO,ESTADO) " + " VALUES ('" + saldos.ASIENTO + "', " + "'" + saldos.COD_COMPANIA + "', " + "'" + saldos.COD_PAIS + "', " + "'" + saldos.CREDITOS_LOCAL + "', " + "'" + saldos.CUENTA_CONTABLE + "', " + "'" + saldos.DEBITO_DOLAR + "', " + "'" + saldos.DEBITO_LOCAL + "', " + "'" + saldos.DESCRIPCION_NIT + "', " + "'" + saldos.DESCRIPCIÓN + "', " + "TO_DATE('" + saldos.FECHA + "','mm/dd/yyyy hh:mi:ss AM'), " + "'" + saldos.FUENTE + "', " + "'" + saldos.NIT + "', " + "'" + saldos.NOMBRE_COMPANIA + "', " + "'" + saldos.NOMBRE_PAIS + "', " + "'" + saldos.ORIGEN + "', " + "'" + saldos.PAQUETE + "', " + "'" + saldos.REFERENCIA + "', " + "'" + saldos.TIPO_ASIENTO + "', " + "'" + "0" + "')"; result = conexion.Execute(vSql, "BAW"); if (result) { System.IO.File.AppendAllText(ruta, "PROCESO CORRECTO \n"); mensaje2 = "PROCESO CORRECTO"; codigo = "101"; } else { System.IO.File.AppendAllText(ruta, "TRANSACCION DUBLICADA \n"); mensaje2 = "TRANSACCION DUBLICADA"; codigo = "104"; } } catch (Exception EX) { mensaje2 = "ERROR BD" + EX.ToString(); codigo = " "; System.IO.File.AppendAllText(ruta, "ERROR (BAW -> )" + mensaje2 + "\n"); return(false); } return(result); }
protected void loadTransSession() { try { AGENT aGENT = (AGENT)Session["aGENT"]; DateTime nullDate = DateTime.Parse(ConfigurationManager.AppSettings["NULL_DATE"].ToString()); TRANS tRANS = new TRANS(); tRANS.CUSTID = int.Parse(Session["snsenderID"].ToString()); tRANS.RECEIVERID = int.Parse(Session["snreceiverID"].ToString()); tRANS.LOCATIONID = int.Parse(Session["snlocationID"].ToString()); tRANS.TRANSDT = DateTime.Parse(txtDate.Text); tRANS.TRANSAMOUNT = decimal.Parse(txtSendingAmount.Text); tRANS.TRANSFEES = decimal.Parse(txtServiceCharge.Text); tRANS.TRANSOTHERFEES = decimal.Parse(txtOtherServiceCharge.Text); tRANS.CAUSETRANSOTHERFEES = txtCauseOtherServiceCharges.Text; tRANS.TRANSPROMOCODE = txtDiscount.Text; tRANS.TRANSPROMO = 0; tRANS.TRANSTOTALAMOUNT = decimal.Parse(txtTotalCharge.Text); tRANS.FLAG_SM_RECEIVER = 'N'; tRANS.SM_RECEIVER = ""; tRANS.FLAG_CALL_RECEIVER = 'N'; tRANS.RECEIVERPHONENO = ""; tRANS.FLAG_DD = 'N'; tRANS.FLAG_TESTQUESTION = 'N'; tRANS.TESTQUESTION = txtTestQuestion.Text; tRANS.TESTANSWER = txtTestAnswer.Text; tRANS.FLAG_CALLSENDER = 'N'; tRANS.FLAG_SMSSENDER = 'N'; tRANS.FLAG_EMAILSENDER = 'N'; tRANS.SENDEREMAILADDRESS = ""; tRANS.TRANSSTATUS = "PENDING"; tRANS.TRANSRECEIVEDID = ""; tRANS.TRANSRECEIVEDATE = nullDate; tRANS.CREATEDBY = int.Parse(Session["userInfoID"].ToString()); tRANS.CREATEDON = DateTime.Now; tRANS.UPDATEDBY = int.Parse(Session["userInfoID"].ToString()); tRANS.UPDATEDON = DateTime.Now; tRANS.AGENTID = aGENT.AGENTID; tRANS.REFCODE = lblReferenceCode.Text; if (Session["sessionTRANS"] == null) { List <TRANS> SSTRANS = new List <TRANS>(); SSTRANS.Add(tRANS); Session.Remove("sessionTRANS"); Session["sessionTRANS"] = SSTRANS; } else { ((List <TRANS>)Session["sessionTRANS"]).Add(tRANS); } //List<TRANS> SSTRANSFINAL = new List<TRANS>(); //SSTRANSFINAL = (List<TRANS>)Session["sessionTRANS"]; //gvTRANS.DataSource = SSTRANSFINAL; //gvTRANS.DataBind(); } catch (Exception EX) { lblmessage.Text = EX.ToString(); } }
/* * Sends the NPDUs contained within the provided EBO Image File to the specified * MPX device. * * input: * string ImageFile: Image file location relative to current working * directory * string IP: String representation of targeted MPX device's IP address * * return: * string "Finished": Message string for console output in Main() */ private static string Replay(string ImageFile, string IP) { byte[] FileBuffer; try { File.SetAttributes(ImageFile, FileAttributes.Normal); FileBuffer = File.ReadAllBytes(ImageFile); } catch (Exception Ex) { return(Ex.ToString()); } //Frame header, bytes byte[] BVLCHeader = new byte[] { 0x81, //Type 0x0A, //Function 0x00, 0x00 }; //Length (frame length + 2) Socket Sender; try { IPAddress MPXIP = IPAddress.Parse(IP); IPEndPoint RemoteEP = new IPEndPoint(MPXIP, 47808); //47808 == 0xbac0 Sender = new Socket(MPXIP.AddressFamily, SocketType.Dgram, ProtocolType.Udp); try { Sender.Connect(RemoteEP); Console.WriteLine("Socket connected to {0}", Sender.RemoteEndPoint.ToString()); } catch (ArgumentNullException ANE) { return(String.Format("ERROR - Argument Null Exception:\r\n{0}\r\n", ANE.ToString())); } catch (SocketException SE) { return(String.Format("ERROR - Socket Exception:\r\n{0}\r\n", SE.ToString())); } } catch (Exception EX) { return(String.Format("ERROR - Unexpected Exception:\r\n{0}\r\n", EX.ToString())); } byte[] Frame, Temp; bool First = true; int Len = 0, I = 0, Count = 0, SegI; while (I < FileBuffer.Length) { Len = BitConverter.ToInt16(new byte[] { FileBuffer[I + 1], FileBuffer[I] }, 0); I += 2; Frame = new byte[Len]; for (SegI = 0; SegI < Len; SegI++) { Frame[SegI] = FileBuffer[I]; I++; } if (!First) { Temp = Shift(Frame.Length + 4); BVLCHeader[2] = Temp[0]; BVLCHeader[3] = Temp[1]; try { Sender.Send(BVLCHeader.Concat(Frame).ToArray()); } catch (ArgumentNullException ANE) { return(String.Format("ERROR - Argument Null Exception:\r\n{0}\r\n", ANE.ToString())); } catch (SocketException SE) { return(String.Format("ERROR - Socket Exception:\r\n{0}\r\n", SE.ToString())); } catch (Exception EX) { return(String.Format("ERROR - Unexpected Exception:\r\n{0}\r\n", EX.ToString())); } } else { Console.WriteLine("Sending..."); First = false; } Count++; Thread.Sleep(100); //Time interval for MPX to receive messages } Console.WriteLine("Closing connection..."); Sender.Shutdown(SocketShutdown.Both); Sender.Close(); return(String.Format("Finished Replay - {0} instructions sent", Count)); }
private void _Start() { try { if (IsAutoPrint) { Model.t_weighact _Weighact = Common._db.Queryable <Model.t_weighact>().Where(r => r.MAT_ACT_WT > 0 && r.UNIT_CODE == SoftConfig.UnitCode).OrderByDescending(r => r.PROD_TIME).FirstOrDefault(); if (_Weighact != null) { Logger.Info("_Start " + "当前的插表时刻:" + _Weighact.PROD_TIME); Logger.Info("_Start " + "上次有效的插表时刻:" + LastDateTime); if (LastDateTime != _Weighact.PROD_TIME) { SoftConfig.buff++; SoftConfig.BudleNo = jNPrinter.GetBudleNo(SoftConfig.buff); txtBule.Text = SoftConfig.BudleNo.ToString(); //if (SoftConfig.buff >= SoftConfig.MaxBult+ 2 - SoftConfig.BuleStart) //{ // SoftConfig.BudleNo = "7001"; // SoftConfig.buff = 1; //} //SoftConfig.RollPlanNo = jNPrinter.GetRollingNo(SoftConfig.buff == 1);//轧制号 //SoftConfig.HeatNo = jNPrinter.GetHeatNo(SoftConfig.buff == 1); SoftConfig.RollPlanNo = txtR.Text; SoftConfig.HeatNo = txtF.Text; //SoftConfig.BudleNo = "7001"; //SoftConfig.BudleNo = jNPrinter.GetBudleNo(SoftConfig.buff); //if (LastROLL_PLAN_NO != _Weighact.ROLL_PLAN_NO) //{ // SoftConfig.RollPlanNo = jNPrinter.GetRollingNo(SoftConfig.buff == 1);//轧制号 // SoftConfig.HeatNo = jNPrinter.GetHeatNo(); // SoftConfig.BudleNo = "7001"; //} //else //{ // SoftConfig.BudleNo = jNPrinter.GetBudleNo(); //} LastDateTime = _Weighact.PROD_TIME; Model.BaseData baseData = new Model.BaseData(); string weighJson = JsonConvert.SerializeObject(_Weighact); baseData = JsonConvert.DeserializeObject <Model.BaseData>(weighJson); baseData.NewROLLCode = SoftConfig.RollPlanNo; baseData.NewHEAT_NO = SoftConfig.HeatNo; baseData.NewHEATNo = Convert.ToInt32(SoftConfig.BudleNo); baseData.create_Time = DateTime.Parse($"{_Weighact.INSERT_TIME.Substring(0, 4)}/{_Weighact.INSERT_TIME.Substring(4, 2)}/{_Weighact.INSERT_TIME.Substring(6, 2)} {_Weighact.INSERT_TIME.Substring(8, 2)}:{_Weighact.INSERT_TIME.Substring(10, 2)}:{_Weighact.INSERT_TIME.Substring(12, 2)} "); t_BaseDatasList.Add(baseData); SoftConfig.Specifications = cmbSpec.Text; //理重不打印 string strWeight = Convert.ToDouble(_Weighact.MAT_ACT_WT).ToString(); if (_Weighact.MAT_ACT_WT > 0 && Convert.ToDouble(_Weighact.MAT_ACT_WT).ToString().Length > 5) { double _W = Convert.ToDouble(_Weighact.MAT_ACT_WT * 1000); string _str = _W.ToString().Split('.').ToArray()[0];//重量信息 //jNPrinter.AutoPNGJNPrint(/*_Weighact.SG_SIGN*/ "HRB400E", SoftConfig.HeatNo.Trim(), SoftConfig.RollPlanNo.Trim(), SoftConfig.BudleNo, // SoftConfig.Specifications, _str, "GB/T1499.2-2018", DateTime.Now.ToString("yyyyMMdd"), // "0", "0", "XK05-001-00042"); jNPrinter.AutoPNGJNPrint(cmbGrade.Text, SoftConfig.HeatNo.Trim(), SoftConfig.RollPlanNo.Trim(), SoftConfig.BudleNo, SoftConfig.Specifications, _str, "GB/T1499.2-2018", DateTime.Now.ToString("yyyyMMdd"), "0", "0", "XK05-001-00042"); } } } } } catch (Exception EX) { Logger.Info("方法异常:" + EX.ToString()); } }
private void button1_Click(object sender, EventArgs e) { if (numericUpDown1.Value == 0) { MessageBox.Show("Sie müssen die Dauer größer als Null festlegen."); } else { act = true; try { if (textBox3.Text.Contains("^")) { frequency = textBox3.Text.Split('^').Select(b => Convert.ToInt32(b)).ToArray(); hz = (int)Math.Pow(frequency[0], (frequency[1] / 2)); } else { hz = Convert.ToInt32(textBox3.Text); } textBox3.Text = hz.ToString(); } catch (Exception EX) { richTextBox3.AppendText(EX.ToString()); MessageBox.Show("Das folgende Programm hat einen oder mehrere Fehler bei Ihrer Eingabe festgestellt:" + Environment.NewLine + EX.ToString()); } if ((int)numericUpDown1.Value != 0) { label10.Text = "wave density: 0." + ran.Next(0, 1000) + " λ"; } Thread newthread = new Thread(new ThreadStart(cause)); newthread.Start(); } }
public bool GuardarOrdenCompraBD(Compra_Info info) { try { using (EntitiesNexpirion db = new EntitiesNexpirion()) { db.SetCommandTimeOut(3000); if (db.indocume.Where(q => q.num_recibo == info.Codigo && q.eliminado == false && q.fecha == info.Fecha).Count() > 0) { return(true); } var info_producto = data_producto.get_info_ProductoNexp(info.CodProducto.ToString().Trim()); if (info_producto == null) { return(true); } var info_proveedor_nx = data_proveedor.get_info_ProveedorNexp(info.ProvCodigo.ToString().Trim()); if (info_proveedor_nx == null) { return(true); } var info_proveedor = data_proveedor.get_info("PRV", info.ProvCodigo.ToString().Trim()); if (info_proveedor == null) { return(true); } var info_bodega = data_producto.get_info_BodegaNexp(info.CodProducto.ToString().Trim()); if (info_bodega == null) { return(true); } var nombre = info_producto.nombre.ToString().Substring(0, 59); dbultnum entity = db.dbultnum.Where(q => q.tipo == "CO").FirstOrDefault(); var num_compra = entity.numero + 1; db.indocume.Add(new indocume { tipo = "CO", numero = num_compra, pedido = 0, fecha = info.Fecha, fecha_fac = info.Fecha, fecha_com = info.Fecha, producto = info_producto.codigo, nombre = nombre, cantidad = Convert.ToDecimal(info.Cantidad), proveedor = info_proveedor_nx.codigo, concepto = info_proveedor.ConceptoCompra, plazo = 0, porc_desc = 0, factor = 0, total = Convert.ToDecimal(info.Total), costo = Convert.ToDecimal(info.Precio), fob = 0, orden = "", comentario = info.Comentario, tip_aplic = "", num_aplic = 0, tip_aplix = "", num_aplix = 0, bloqueado = false, aprobado = false, usuario = "", digitado = DateTime.Now.Date, fecha_apr = DateTime.Now.Date, cantidad_op = 0, impreso = false, eliminado = false, bodega_int = info_bodega.bodega_int, bodega_orig = "", solicita = false, aceptado = false, fecha_soli = DateTime.Now.Date, fecha_recep = DateTime.Now.Date, fecha_acep = DateTime.Now.Date, recibido = false, lote = "", num_recibo = Convert.ToDecimal(info.Codigo).ToString(), usr_agr = "", usr_cor = "", centro = "" }); db.fcmovinv.Add(new fcmovinv { tipo = "CO", numero = num_compra, numreg = 1, fecha = info.Fecha, producto = info_producto.codigo, nombre = nombre, bodega = "", fra = Convert.ToDecimal(info.Precio), peso = info_producto.peso, und = Convert.ToDecimal(info.Cantidad), cantidad = Convert.ToDecimal(info.Cantidad), stock = 0, tip_ped = "", pedido = 0, tipreg = 1, descuento = 0, precio_vta = Convert.ToDecimal(info.Precio), precio_lst = Convert.ToDecimal(info.Precio), subtotal = Convert.ToDecimal(info.Total), costo_und = Convert.ToDecimal(info.Precio), costo = Convert.ToDecimal(info.Precio), promedio = 0, tip_prec = 0, tip_produc = info_producto.tipoitm, porc_desc = 0, sucursal = "", cliente = "", vendedor = "", servicio = false, ubicacion = "", motivo = "", eliminado = false, usuario = "", digitado = DateTime.Now.Date, concepto = "", comentario = info.Comentario, bodega_int = info_bodega.bodega_int, lote = "", usr_agr = "", usr_cor = "" }); entity.numero = num_compra; db.SaveChanges(); } return(true); } catch (Exception EX) { data_log.GuardarDB(new LogError_Info { Controlador = "GenerarOrdenCompra", Error = "Error: " + EX.ToString() + " " + string.Format("Compra: {0}", JsonConvert.SerializeObject(info)), IdUsuario = info.IdUsuario }); return(false); } }