/// <summary> Получение информации об изделии из БД </summary> public Product GetProductInfo(string ProductID) { for (int i = 0; i < Prods.Count; i++) { Product p = (Product)Prods[i]; if (p.ID == ProductID) { if (p.Registrations == null) { return(new Product(p.ID, p.ModelID, p.Model, null)); } ArrayList Regs = null; for (int j = 0; j < p.Registrations.Count; j++) { Registration r = (Registration)p.Registrations[j]; if (DateTime.Now < r.Time.Add(ProgramSettings.ReentrancePeriod)) { r = new Registration(r.Time, r.Line, r.DeffectID, r.WorkerID, r.IsChanged); if (Regs == null) { Regs = new ArrayList(); } Regs.Add(r); } } return(new Product(p.ID, p.ModelID, p.Model, Regs)); } } return(null); }
public Regs RegsGrid(String CemexId) { Regs userse = new Regs(); var param = new List<SqlParameter>(); param.Add(new SqlParameter("@CemexId", CemexId)); IRdmsConnection cnn = new SqlRdmsConnection<UserIdDTO>(UtilSh.strCnn2, "dbo.GetPermission", param); var result = cnn.Execute(true, CommandType.StoredProcedure); var res = (from r in result select (UserIdDTO)r).ToArray(); param.Clear(); string connectionString = UtilSh.strCnn2;/* System.Configuration.ConfigurationManager.ConnectionStrings["cnnSql2"].ToString();*/ using (SqlConnection connection = new SqlConnection(connectionString)) { using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandText = "Exec dbo.RegsGrid @User="******"ID"]); user.Llave = Convert.ToString(dataReader["Llave"]); user.CodCliente = Convert.ToString(dataReader["CodCliente"]); user.NCliente = Convert.ToString(dataReader["NCliente"]); user.Pais = Convert.ToString(dataReader["Pais"]); user.Cupo = Convert.ToString(dataReader["Cupo"]); user.CupoOtorgado = Convert.ToString(dataReader["CupoOtorgado"]); user.Plazo = Convert.ToString(dataReader["Plazo"]); user.PlazoOtorgado = Convert.ToString(dataReader["PlazoOtorgado"]); user.Tipo = Convert.ToString(dataReader["Tipo"]); user.Estado = Convert.ToString(dataReader["Estado"]); user.Vice = Convert.ToString(dataReader["Vice"]); user.SolCre = Convert.ToString(dataReader["SolCre"]); user.Pagare = Convert.ToString(dataReader["Pagare"]); user.Cedula = Convert.ToString(dataReader["Cedula"]); user.Camara = Convert.ToString(dataReader["Camara"]); user.Rut = Convert.ToString(dataReader["Rut"]); user.Comentarios = Convert.ToString(dataReader["Comentarios"]); user.Fecha = Convert.ToString(dataReader["Fecha"]); user.Hora = Convert.ToString(dataReader["Hora"]); user.ComentarioCredito = Convert.ToString(dataReader["ComentarioCredito"]); user.Comercial = Convert.ToString(dataReader["Comercial"]); userse.Add(user); } } //Convert.ToInt32(paramTotalRecords.Value); } } /* param = new List<SqlParameter>(); param.Add(new SqlParameter("@User", CemexId)); cnn = new SqlRdmsConnection<RegDTO>(UtilSh.strCnn2, "dbo.RegsGrid",param);//Procedimiento almacenado para inserción de solicitudes. var result2 = cnn.Execute(true, CommandType.StoredProcedure); var res2 = (from r in result2 select (RegDTO)r).ToArray(); foreach(var x in res2) { userse.Add(x); }*/ return userse; }