/// <summary> /// /// </summary> /// <param name="PlanID"> </param> /// <param name="BillNumber"> </param> /// <param name="DateTime"> </param> /// <param name="EnterpriseID"> </param> /// <param name="WasteCode"> </param> /// <param name="Status"> </param> /// <returns></returns> public static DataTable GetSum(string StartTime, string EndTime, int IsByProduceName) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { StringBuilder sb = new StringBuilder(); sb.Append("select sum(Amount) as Total,WasteName "); if (IsByProduceName == 1) { sb.Append(",ProduceName"); } sb.Append(" from vWasteStorage where Status>=2"); if (!string.IsNullOrEmpty(StartTime)) { sb.Append(" and DateTime>='" + StartTime + "'"); } if (!string.IsNullOrEmpty(EndTime)) { sb.Append(" and DateTime<='" + EndTime + "'"); } sb.Append(" group by "); if (IsByProduceName == 1) { sb.Append(" ProduceName,WasteName"); sb.Append(" order by ProduceName"); } else { sb.Append(" WasteName"); } IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, sb.ToString(), null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="StorageID"> </param> /// <returns></returns> public static Entity.WasteStorage GetWasteStorage(int StorageID) { Entity.WasteStorage entity = null; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [vWasteStorage] where StorageID='" + StorageID + "'", null); while (dataReader.Read()) { entity = new Entity.WasteStorage(); entity.StorageID = DataHelper.ParseToInt(dataReader["StorageID"].ToString()); entity.PlanNumber = dataReader["PlanNumber"].ToString(); entity.PlanID = DataHelper.ParseToInt(dataReader["PlanID"].ToString()); entity.BillNumber = dataReader["BillNumber"].ToString(); entity.DateTime = DataHelper.ParseToDate(dataReader["DateTime"].ToString()); entity.EnterpriseID = DataHelper.ParseToInt(dataReader["EnterpriseID"].ToString()); entity.ProduceName = dataReader["ProduceName"].ToString(); entity.WasteCode = dataReader["WasteCode"].ToString(); entity.WasteName = dataReader["WasteName"].ToString(); entity.Amount = decimal.Parse(dataReader["Amount"].ToString()); entity.DriverID = DataHelper.ParseToInt(dataReader["DriverID"].ToString()); entity.RealName = dataReader["RealName"].ToString(); entity.CarID = DataHelper.ParseToInt(dataReader["CarID"].ToString()); entity.CarNumber = dataReader["CarNumber"].ToString(); entity.PondID = DataHelper.ParseToInt(dataReader["PondID"].ToString()); entity.PondName = dataReader["PondName"].ToString(); entity.ReceiverID = DataHelper.ParseToInt(dataReader["ReceiverID"].ToString()); entity.ReceiverName = dataReader["ReceiverName"].ToString(); //entity.CreateDate = DataHelper.ParseToDate(dataReader["CreateDate"].ToString()); //entity.CreateUser = dataReader["CreateUser"].ToString(); //entity.UpdateDate = DataHelper.ParseToDate(dataReader["UpdateDate"].ToString()); //entity.UpdateUser = dataReader["UpdateUser"].ToString(); entity.Status = DataHelper.ParseToInt(dataReader["Status"].ToString()); entity.StatusName = dataReader["StatusName"].ToString(); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(entity); }
public static DataTable QueryTransferPlanEx(string ContractNumber, string ProduceName, string StartTime, string EndTime, string WasteName, int StatusID) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { StringBuilder sb = new StringBuilder(); sb.Append("Select ContractNumber as 合同编号,PlanNumber as 计划编号,ProduceName as 企业名称,WasteName as 废物名称,StartDate as 起始日期,EndDate as 结束日期,PlanAmount as 计划数量,ApprovalDate as 批准日期,Status as 审核状态 from [vTransferPlan] where 1=1 "); if (!string.IsNullOrEmpty(ContractNumber)) { sb.Append(" and ContractNumber like '%" + ContractNumber + "%'"); } if (!string.IsNullOrEmpty(ProduceName)) { sb.Append(" and ProduceName like '%" + ProduceName + "%'"); } if (!string.IsNullOrEmpty(WasteName)) { sb.Append(" and WasteName like '%" + WasteName + "%'"); } if (!string.IsNullOrEmpty(StartTime)) { sb.Append(" and EndDate<='" + StartTime + "'"); } if (!string.IsNullOrEmpty(EndTime)) { sb.Append(" and StartDate>='" + EndTime + "'"); } if (StatusID != -2) { sb.Append(" and StatusID='" + StatusID + "'"); } sb.Append(" order by PlanNumber"); IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, sb.ToString(), null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="PondID"> </param> /// <param name="WasteCode"> </param> /// <param name="DateTime"> </param> /// <param name="ReceiverEnterpriseID"> </param> /// <param name="DriverID"> </param> /// <param name="ConsignorID"> </param> /// <param name="Status"> </param> /// <returns></returns> public static DataTable GetAllProductOutEx(string PondName, string WasteName, string StartTime, string EndTime, string ReceiverEnterpriseName, int Status) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { StringBuilder sb = new StringBuilder(); sb.Append("Select DateTime as 日期,PondName as 罐池号,WasteName as 成品名称,Amount as 数量,Name as 收货单位,CarNumber 车牌号,RealName as 驾驶员,UserRealName as 发货人,StatusName as 状态 from [vProductOut] where 1=1 "); if (!string.IsNullOrEmpty(PondName)) { sb.Append(" and PondName like '%" + PondName + "%'"); } if (!string.IsNullOrEmpty(WasteName)) { sb.Append(" and WasteName like '%" + WasteName + "%'"); } if (!string.IsNullOrEmpty(StartTime)) { sb.Append(" and DateTime>='" + StartTime + "'"); } if (!string.IsNullOrEmpty(EndTime)) { sb.Append(" and DateTime<='" + EndTime + "'"); } if (!string.IsNullOrEmpty(ReceiverEnterpriseName)) { sb.Append(" and Name like '%" + ReceiverEnterpriseName + "%'"); } if (Status != -2) { sb.Append(" and Status='" + Status + "'"); } sb.Append(" order by DateTime desc"); IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, sb.ToString(), null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="EnterpriseID"> </param> /// <returns></returns> public static Entity.Enterprise GetEnterprise(int EnterpriseID) { Entity.Enterprise entity = null; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [Enterprise] where EnterpriseID='" + EnterpriseID + "'", null); while (dataReader.Read()) { entity = new Entity.Enterprise(); entity.EnterpriseID = DataHelper.ParseToInt(dataReader["EnterpriseID"].ToString()); entity.Name = dataReader["Name"].ToString(); entity.LawManCode = dataReader["LawManCode"].ToString(); entity.OrganizationCode = dataReader["OrganizationCode"].ToString(); entity.PastName = dataReader["PastName"].ToString(); entity.SetUpDate = DataHelper.ParseToDate(dataReader["SetUpDate"].ToString()); entity.Type = DataHelper.ParseToInt(dataReader["Type"].ToString()); entity.FaxNumber = dataReader["FaxNumber"].ToString(); entity.Industry = DataHelper.ParseToInt(dataReader["Industry"].ToString()); entity.AreaCode = dataReader["AreaCode"].ToString(); entity.PostCode = dataReader["PostCode"].ToString(); entity.Address = dataReader["Address"].ToString(); entity.LawMan = dataReader["LawMan"].ToString(); entity.Email = dataReader["Email"].ToString(); entity.Phone1 = dataReader["Phone1"].ToString(); entity.Telphone1 = dataReader["Telphone1"].ToString(); //entity.CreateDate = DataHelper.ParseToDate(dataReader["CreateDate"].ToString()); //entity.CreateUser = dataReader["CreateUser"].ToString(); //entity.UpdateDate = DataHelper.ParseToDate(dataReader["UpdateDate"].ToString()); //entity.UpdateUser = dataReader["UpdateUser"].ToString(); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(entity); }
/// <summary> /// /// </summary> /// <param name="Name"> </param> /// <param name="OrganizationCode"> </param> /// <param name="Type"> </param> /// <param name="AreaCode"> </param> /// <returns></returns> public static DataTable GetAllEnterpriseEx(string LawManCode, string Name, string OrganizationCode, int Type, string AreaCode) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { StringBuilder sb = new StringBuilder(); sb.Append("Select * from [Enterprise] where 1=1 "); if (!string.IsNullOrEmpty(LawManCode)) { sb.Append(" and LawManCode like '%" + LawManCode + "%'"); } if (!string.IsNullOrEmpty(Name)) { sb.Append(" and ( Name like '%" + Name + "%' or PastName like '%" + Name + "%')"); } if (!string.IsNullOrEmpty(OrganizationCode)) { sb.Append(" and OrganizationCode like '%" + OrganizationCode + "%'"); } if (Type != -2) { sb.Append(" and Type='" + Type + "'"); } if (AreaCode != "3304") { sb.Append(" and AreaCode ='" + AreaCode + "'"); } IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, sb.ToString(), null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="DateTime"> </param> /// <returns></returns> public static List <Entity.WasteStorage> GetSumWasteStorage() { List <Entity.WasteStorage> list = new List <Entity.WasteStorage>(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { string Start = string.Format("{0}-01-01", DateTime.Now.Year); string End = string.Format("{0}-12-31", DateTime.Now.Year); IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "select sum(Amount) as Total,WasteName from vWasteStorage where Status>=2 and DateTime>='" + Start + "' and DateTime<='" + End + "' group by WasteName", null); while (dataReader.Read()) { Entity.WasteStorage entity = new Entity.WasteStorage(); //entity.StorageID = DataHelper.ParseToInt(dataReader["StorageID"].ToString()); //entity.PlanID = DataHelper.ParseToInt(dataReader["PlanID"].ToString()); //entity.BillNumber = dataReader["BillNumber"].ToString(); //entity.DateTime = DataHelper.ParseToDate(dataReader["DateTime"].ToString()); //entity.EnterpriseID = DataHelper.ParseToInt(dataReader["EnterpriseID"].ToString()); //entity.WasteCode = dataReader["WasteCode"].ToString(); entity.WasteName = dataReader["WasteName"].ToString(); entity.Amount = decimal.Parse(dataReader["Total"].ToString()); //entity.DriverID = DataHelper.ParseToInt(dataReader["DriverID"].ToString()); //entity.PondID = DataHelper.ParseToInt(dataReader["PondID"].ToString()); //entity.ReceiverID = DataHelper.ParseToInt(dataReader["ReceiverID"].ToString()); //entity.CreateDate = DataHelper.ParseToDate(dataReader["CreateDate"].ToString()); //entity.CreateUser = dataReader["CreateUser"].ToString(); //entity.UpdateDate = DataHelper.ParseToDate(dataReader["UpdateDate"].ToString()); //entity.UpdateUser = dataReader["UpdateUser"].ToString(); //entity.Status = DataHelper.ParseToInt(dataReader["Status"].ToString()); list.Add(entity); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(list); }
/// <summary> /// /// </summary> /// <param name="PlanID"> </param> /// <returns></returns> public static Entity.TransferPlan GetTransferPlan(int PlanID) { Entity.TransferPlan entity = null; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [vTransferPlan] where PlanID='" + PlanID + "'", null); while (dataReader.Read()) { entity = new Entity.TransferPlan(); entity.PlanID = DataHelper.ParseToInt(dataReader["PlanID"].ToString()); entity.ContractID = DataHelper.ParseToInt(dataReader["ContractID"].ToString()); entity.PlanNumber = dataReader["PlanNumber"].ToString(); entity.ApprovalDate = DataHelper.ParseToDate(dataReader["ApprovalDate"].ToString()); entity.StartDate = DataHelper.ParseToDate(dataReader["StartDate"].ToString()); entity.EndDate = DataHelper.ParseToDate(dataReader["EndDate"].ToString()); entity.PlanAmount = decimal.Parse(dataReader["PlanAmount"].ToString()); entity.WasteCode = dataReader["WasteCode"].ToString(); entity.WasteName = dataReader["WasteName"].ToString(); entity.ProduceID = DataHelper.ParseToInt(dataReader["ProduceID"].ToString()); entity.ProduceName = dataReader["ProduceName"].ToString(); entity.Remark = dataReader["Remark"].ToString(); //entity.CreateUser = dataReader["CreateUser"].ToString(); //entity.CreateDate = DataHelper.ParseToDate(dataReader["CreateDate"].ToString()); //entity.UpdateUser = dataReader["UpdateUser"].ToString(); //entity.UpdateDate = DataHelper.ParseToDate(dataReader["UpdateDate"].ToString()); entity.StatusID = DataHelper.ParseToInt(dataReader["StatusID"].ToString()); entity.IYear = DataHelper.ParseToInt(dataReader["IYear"].ToString()); entity.Number = DataHelper.ParseToInt(dataReader["Number"].ToString()); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(entity); }
/// <summary> /// /// </summary> /// <param name="FromPondID"> </param> /// <param name="FromWasteCode"> </param> /// <param name="Status"> </param> /// <returns></returns> public static DataTable GetAllWasteToProduct(int FromPondID, string FromWasteCode, int Status) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [WasteToProduct] where FromPondID='" + FromPondID + "' and FromWasteCode='" + FromWasteCode + "' and Status='" + Status + "'", null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="PlanID"> </param> /// <param name="BillNumber"> </param> /// <param name="DateTime"> </param> /// <param name="EnterpriseID"> </param> /// <param name="WasteCode"> </param> /// <param name="Status"> </param> /// <returns></returns> public static DataTable GetAllWasteStorage(int PlanID, string BillNumber, DateTime DateTime, int EnterpriseID, string WasteCode, int Status) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [WasteStorage] where PlanID='" + PlanID + "' and BillNumber='" + BillNumber + "' and DateTime='" + DateTime + "' and EnterpriseID='" + EnterpriseID + "' and WasteCode='" + WasteCode + "' and Status='" + Status + "'", null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="IsStop"> </param> /// <returns></returns> public static DataTable GetAllDriver(bool IsStop) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [Driver] where IsStop='" + IsStop + "'", null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="ID"> </param> /// <returns></returns> public static DataTable GetUserNamesEx2(string RoleIDs) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select UserID,RealName from [vUserRole] where IsStop=0 and RoleID in (" + RoleIDs + ")", null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
public void GetUsers() { DataBase db = new DataBase(); DataTable dt = new DataTable(); string sql = "select CustomId,FullName,Address,City,id,BirthDay,LicenseNumber,LicenseLevel,LicenseProductionDate,Email,Phone from CustomersTable where CustomId = " + this.UserId; dt = db.ExecuteReader(sql); this.Name = dt.Rows[0]["FullName"].ToString(); this.Address = dt.Rows[0]["Address"].ToString(); this.City = (int)dt.Rows[0]["City"]; this.Id = dt.Rows[0]["id"].ToString(); this.BirthDay = dt.Rows[0]["BirthDay"].ToString(); this.LicenseNumber = dt.Rows[0]["LicenseNumber"].ToString(); this.LicenseLevel = (int)dt.Rows[0]["LicenseLevel"]; this.DateOfIssuanceLicense = dt.Rows[0]["LicenseProductionDate"].ToString(); this.Email = dt.Rows[0]["Email"].ToString(); this.Phone = dt.Rows[0]["Phone"].ToString(); return; }
/// <summary> /// /// </summary> /// <returns></returns> public static DataTable GetUseWaste() { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select distinct Stores,WasteName from [vPond]", null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
{/// <summary> /// /// </summary> /// <param name="BillNumber"> </param> /// <returns></returns> public static DataTable GetMonitorResult(int MonitorID) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [vMonitorResult] where MonitorID='" + MonitorID + "'", null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="IsDelete"> </param> /// <returns></returns> public static DataTable GetAllAreaEx2(int IsDelete) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select distinct AreaCode,ShortName from [Area] where IsDelete='" + IsDelete + "'", null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <returns></returns> public static DataTable GetAllProductDetail() { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [ProductDetail]", null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="ContractID"> </param> /// <param name="PlanNumber"> </param> /// <param name="StartDate"> </param> /// <param name="EndDate"> </param> /// <param name="WasteCode"> </param> /// <param name="StatusID"> </param> /// <returns></returns> public static DataTable GetAllTransferPlan(int ContractID, string PlanNumber, DateTime StartDate, DateTime EndDate, string WasteCode, int StatusID) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [TransferPlan] where ContractID='" + ContractID + "' and PlanNumber='" + PlanNumber + "' and StartDate='" + StartDate + "' and EndDate='" + EndDate + "' and WasteCode='" + WasteCode + "' and StatusID='" + StatusID + "'", null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
public person RegUser(string TxtName, string TxtAddress, int TxtCity, string TxtId, string TxtDateOfBirth, string TxtLicenseNumber, int DdlLicensCode, string TxtDateOfIssuanceLicense, string Email, string Password, string Phone, string Temporary) { DataBase db = new DataBase(); person per = new person(); string sql = "insert into CustomersTable (FullName,Address,City,id,BirthDay,LicenseNumber,LicenseLevel,LicenseProductionDate,Email,Password,Phone,ForgetPass) values ('" + TxtName + "','" + TxtAddress + "','" + TxtCity + "','" + TxtId + "','" + TxtDateOfBirth + "','" + TxtLicenseNumber + "','" + DdlLicensCode + "','" + TxtDateOfIssuanceLicense + "','" + Email + "','" + Password + "','" + Phone + "','" + Temporary + "')"; int RecCount = db.ExecuteNonQuery(sql); if (RecCount != 0) { sql = "select CustomId,FullName,Email from CustomersTable where Email = '" + Email + "'"; DataTable dt = db.ExecuteReader(sql); per.CustomId = (int)dt.Rows[0]["CustomId"]; per.FullName = dt.Rows[0]["FullName"].ToString(); per.Email = dt.Rows[0]["Email"].ToString(); per.IdNumber = TxtId; per.LiccensNumber = TxtLicenseNumber; per.TelNumber = Phone; per.PhoneNumber = Phone; } return(per); }
/// <summary> /// /// </summary> /// <returns></returns> public static List <Entity.User> GetAllUser() { List <Entity.User> list = new List <Entity.User>(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDbDataParameter[] prams = { }; IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.StoredProcedure, "proc_User_GetAll", prams); while (dataReader.Read()) { Entity.User entity = new Entity.User(); entity.ID = DataHelper.ParseToInt(dataReader["ID"].ToString()); entity.UserName = dataReader["UserName"].ToString(); entity.PassWord = dataReader["PassWord"].ToString(); entity.GUID = dataReader["GUID"].ToString(); //entity.AreaCode = dataReader["AreaCode"].ToString(); //entity.AreaInCharge = dataReader["AreaInCharge"].ToString(); entity.RealName = dataReader["RealName"].ToString(); entity.PwdChgDate = DataHelper.ParseToDate(dataReader["PwdChgDate"].ToString()); //entity.CreateUser = dataReader["CreateUser"].ToString(); //entity.CreateDate = DataHelper.ParseToDate(dataReader["CreateDate"].ToString()); //entity.UpdateUser = dataReader["UpdateUser"].ToString(); //entity.UpdateDate = DataHelper.ParseToDate(dataReader["UpdateDate"].ToString()); entity.IsStop = DataHelper.ParseToBoolean(dataReader["IsStop"].ToString()); list.Add(entity); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(list); }
/// <summary> /// /// </summary> /// <param name="BillNumber"> </param> /// <param name="DateTime"> </param> /// <param name="AnalysisManID"> </param> /// <returns></returns> public static DataTable GetMonitor(int PositionID, string StartTime, string EndTime, int AnalysisManID) { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { StringBuilder sb = new StringBuilder(); sb.Append("Select * from [vMonitor] where 1=1 "); if (PositionID != -2) { sb.Append(" and PositionID='" + PositionID + "'"); } if (!string.IsNullOrEmpty(StartTime)) { sb.Append(" and DateTime>='" + StartTime + "'"); } if (!string.IsNullOrEmpty(EndTime)) { sb.Append(" and DateTime<='" + EndTime + "'"); } if (AnalysisManID != -2) { sb.Append(" and AnalysisManID='" + AnalysisManID + "'"); } //IDataAdapter dataAdapter = new SqlDataAdapter(sb.ToString(),); IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, sb.ToString(), null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <returns></returns> public static DataTable GetAllAnalysis() { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDbDataParameter[] prams = { }; IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.StoredProcedure, "proc_Analysis_GetAll", prams); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return dt; }
public static DataTable QueryTransferPlanAlarm() { DataTable dt = new DataTable(); DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { StringBuilder sb = new StringBuilder(); sb.Append("Select * from [vPlanAmount] where ( EndDate>='" + DateTime.Now.Date + "' and EndDate<='" + DateTime.Now.Date.AddDays(30) + "' ) or Used > 0.9*PlanAmount"); IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, sb.ToString(), null); dt = DAL.DataBase.GetDataTableFromIDataReader(dataReader); } catch (Exception ex) { } finally { db.Conn.Close(); } return(dt); }
/// <summary> /// /// </summary> /// <param name="DateTime"> </param> /// <returns></returns> public static decimal GetPartSumProductDetailEx(string WasteName) { decimal sum = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "select sum(Amount) as Total,WasteName from vProductDetail where Status=2 and DateTime='" + DateTime.Now.Date + "' and WasteName='" + WasteName + "' group by WasteName", null); while (dataReader.Read()) { sum = decimal.Parse(dataReader["Total"].ToString()); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(sum); }
/// <summary> /// /// </summary> /// <param name="ItemID"> </param> /// <returns></returns> public static string GetItemCodeByName(string ItemName) { string ItemCode = ""; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select ItemCode from [AnalysisItem] where ItemName='" + ItemName + "'", null); while (dataReader.Read()) { ItemCode = dataReader["ItemCode"].ToString(); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(ItemCode); }
/// <summary> /// /// </summary> /// <param name="AreaCode"> </param> /// <returns></returns> public static string GetAreaLetter(string AreaCode) { string iReturn = string.Empty; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [Area] where AreaCode='" + AreaCode + "'", null); while (dataReader.Read()) { iReturn = dataReader["LetterCode"].ToString(); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="ContractID"> </param> /// <returns></returns> public static decimal GetPlanAmount(int PlanID) { decimal iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [vPlanAmount] where PlanID='" + PlanID + "'", null); while (dataReader.Read()) { iReturn = decimal.Parse(dataReader["Used"].ToString()); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="ContractNumber"> </param> /// <returns></returns> public static int GetPlanIDByNumber(string PlanNumber) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [TransferPlan] where PlanNumber='" + PlanNumber + "'", null); while (dataReader.Read()) { iReturn = DataHelper.ParseToInt(dataReader["PlanID"].ToString()); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="PlanNumber"> </param> /// <param name="IYear"> </param> /// <returns></returns> public static int GetMaxNumber(string ProduceArea, int IYear) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select MAX(Number) as Number from [vTransferPlan] where ProduceArea='" + ProduceArea + "' and IYear='" + IYear + "'", null); while (dataReader.Read()) { iReturn = DataHelper.ParseToInt(dataReader["Number"].ToString()); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="PlanNumber"> </param> /// <param name="IYear"> </param> /// <returns></returns> public static int GetCount(DateTime?Date) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); try { IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select MAX(Number) as Number from [vFinalWasteLog] where DateTime='" + Date + "'", null); while (dataReader.Read()) { iReturn = DataHelper.ParseToInt(dataReader["Number"].ToString()); } } catch (Exception ex) { } finally { db.Conn.Close(); } return(iReturn); }