using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Reflection; using System.Text; using MESClassLibrary.BLL.Log; using MESClassLibrary.DAL; using MESClassLibrary.EFModel; namespace MESClassLibrary.BLL.TruckBox { public class AddressBLL { BasicBLL db=new BasicBLL(); public List SearchInfo(string location, int flag) { try { //string sql = @"select * from tb_Address_tx where Location = @location and Flag=@flag order by id"; //SqlParameter[] param = new SqlParameter[2]; //param[0] = new SqlParameter("@location", SqlDbType.VarChar); //param[0].Value = location; //param[1] = new SqlParameter("@flag", SqlDbType.Int); //param[1].Value = flag; //return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; return db.SearchAllInfo().Where(p=>p.Location.Equals(location) && p.Flag==flag).ToList(); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); return null; } } public bool UpdateValue(string address, string value) { bool res = false; try { string sql=@"update tb_Address_tx set RealValue='"+ value +@"' where Address='"+ address +@"'"; SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, null); return true; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); } return res; } public List GetDoneValue() { try { return db.SearchAllInfo().Where(p => p.ID.Equals(59) || p.ID.Equals(60)).ToList(); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); return null; } } public string GetTimeValue(int id) { string res = ""; List list = db.SearchAllInfo().Where(p => p.ID.Equals(id)).ToList(); if (list.Any()) { foreach (var item in list) { res = item.RealValue; } } return res; } } }