Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        public static int UpdateTransferPlan(Entity.TransferPlan entity)
        {
            int                   iReturn   = 0;
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();
            SqlTransactionHelper  thelper   = new SqlTransactionHelper(DAL.Config.con);
            IDbTransaction        trans     = thelper.StartTransaction();

            try
            {
                IDbDataParameter[] prams =
                {
                    dbFactory.MakeInParam("@PlanID",       DBTypeConverter.ConvertCsTypeToOriginDBType(entity.PlanID.GetType().ToString()),       entity.PlanID,       32),
                    dbFactory.MakeInParam("@ContractID",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ContractID.GetType().ToString()),   entity.ContractID,   32),
                    dbFactory.MakeInParam("@PlanNumber",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.PlanNumber.GetType().ToString()),   entity.PlanNumber,   50),
                    dbFactory.MakeInParam("@ApprovalDate", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ApprovalDate.GetType().ToString()), entity.ApprovalDate,  0),
                    dbFactory.MakeInParam("@StartDate",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.StartDate.GetType().ToString()),    entity.StartDate,     0),
                    dbFactory.MakeInParam("@EndDate",      DBTypeConverter.ConvertCsTypeToOriginDBType(entity.EndDate.GetType().ToString()),      entity.EndDate,       0),
                    dbFactory.MakeInParam("@PlanAmount",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.PlanAmount.GetType().ToString()),   entity.PlanAmount,   10),
                    dbFactory.MakeInParam("@WasteCode",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.WasteCode.GetType().ToString()),    entity.WasteCode,    50),
                    dbFactory.MakeInParam("@Remark",       DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Remark.GetType().ToString()),       entity.Remark,        0),
                    dbFactory.MakeInParam("@UpdateUser",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateUser.GetType().ToString()),   entity.UpdateUser,   50),
                    dbFactory.MakeInParam("@UpdateDate",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateDate.GetType().ToString()),   entity.UpdateDate,    0),
                    dbFactory.MakeInParam("@StatusID",     DBTypeConverter.ConvertCsTypeToOriginDBType(entity.StatusID.GetType().ToString()),     entity.StatusID,     32),
                    dbFactory.MakeInParam("@IYear",        DBTypeConverter.ConvertCsTypeToOriginDBType(entity.IYear.GetType().ToString()),        entity.IYear,        32),
                    dbFactory.MakeInParam("@Number",       DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Number.GetType().ToString()),       entity.Number, 32)
                };
                iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_TransferPlan_Update", prams);
                thelper.CommitTransaction(trans);
                iReturn = 1;
            }
            catch (Exception ex)
            {
                thelper.RollTransaction(trans);
                iReturn = 0;
            }
            finally
            {
                db.Conn.Close();
            }
            return(iReturn);
        }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="OutID">    </param>
        /// <returns></returns>
        public static Entity.ProductOut GetProductOut(int OutID)
        {
            Entity.ProductOut     entity    = null;
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();

            try
            {
                IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [vProductOut] where OutID='" + OutID + "'", null);
                while (dataReader.Read())
                {
                    entity                      = new Entity.ProductOut();
                    entity.OutID                = DataHelper.ParseToInt(dataReader["OutID"].ToString());
                    entity.PondID               = DataHelper.ParseToInt(dataReader["PondID"].ToString());
                    entity.WasteCode            = dataReader["Stores"].ToString();
                    entity.WasteName            = dataReader["WasteName"].ToString();
                    entity.DateTime             = DataHelper.ParseToDate(dataReader["DateTime"].ToString());
                    entity.Amount               = decimal.Parse(dataReader["Amount"].ToString());
                    entity.ReceiverEnterpriseID = DataHelper.ParseToInt(dataReader["ReceiverEnterpriseID"].ToString());
                    entity.EnterpriseName       = dataReader["Name"].ToString();
                    entity.DriverID             = DataHelper.ParseToInt(dataReader["DriverID"].ToString());
                    entity.DriverName           = dataReader["RealName"].ToString();
                    entity.CarID                = DataHelper.ParseToInt(dataReader["CarID"].ToString());
                    entity.CarNumber            = dataReader["CarNumber"].ToString();
                    entity.ConsignorID          = DataHelper.ParseToInt(dataReader["ConsignorID"].ToString());
                    entity.ConsignorName        = dataReader["UserRealName"].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());
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                db.Conn.Close();
            }
            return(entity);
        }
Exemplo n.º 7
0
        public static int UpdateWasteStorage(Entity.WasteStorage entity)
        {
            int                   iReturn   = 0;
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();
            SqlTransactionHelper  thelper   = new SqlTransactionHelper(DAL.Config.con);
            IDbTransaction        trans     = thelper.StartTransaction();

            try
            {
                IDbDataParameter[] prams =
                {
                    dbFactory.MakeInParam("@StorageID",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.StorageID.GetType().ToString()),    entity.StorageID,    32),
                    dbFactory.MakeInParam("@PlanID",       DBTypeConverter.ConvertCsTypeToOriginDBType(entity.PlanID.GetType().ToString()),       entity.PlanID,       32),
                    dbFactory.MakeInParam("@BillNumber",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.BillNumber.GetType().ToString()),   entity.BillNumber,   20),
                    dbFactory.MakeInParam("@DateTime",     DBTypeConverter.ConvertCsTypeToOriginDBType(entity.DateTime.GetType().ToString()),     entity.DateTime,      0),
                    dbFactory.MakeInParam("@EnterpriseID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.EnterpriseID.GetType().ToString()), entity.EnterpriseID, 32),
                    dbFactory.MakeInParam("@WasteCode",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.WasteCode.GetType().ToString()),    entity.WasteCode,    20),
                    dbFactory.MakeInParam("@Amount",       DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Amount.GetType().ToString()),       entity.Amount,       10),
                    dbFactory.MakeInParam("@DriverID",     DBTypeConverter.ConvertCsTypeToOriginDBType(entity.DriverID.GetType().ToString()),     entity.DriverID,     32),
                    dbFactory.MakeInParam("@PondID",       DBTypeConverter.ConvertCsTypeToOriginDBType(entity.PondID.GetType().ToString()),       entity.PondID,       32),
                    dbFactory.MakeInParam("@ReceiverID",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ReceiverID.GetType().ToString()),   entity.ReceiverID,   32),
                    dbFactory.MakeInParam("@UpdateDate",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateDate.GetType().ToString()),   entity.UpdateDate,    0),
                    dbFactory.MakeInParam("@UpdateUser",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateUser.GetType().ToString()),   entity.UpdateUser,   50),
                    dbFactory.MakeInParam("@Status",       DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()),       entity.Status,       32),
                    dbFactory.MakeInParam("@CarID",        DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CarID.GetType().ToString()),        entity.CarID, 32)
                };
                iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_WasteStorage_Update", prams);
                thelper.CommitTransaction(trans);
                iReturn = 1;
            }
            catch (Exception ex)
            {
                thelper.RollTransaction(trans);
                iReturn = 0;
            }
            finally
            {
                db.Conn.Close();
            }
            return(iReturn);
        }
Exemplo n.º 8
0
        /// <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);
        }
Exemplo n.º 9
0
        /// <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);
        }
Exemplo n.º 10
0
        /// <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);
        }
Exemplo n.º 11
0
        /// <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);
        }
Exemplo n.º 12
0
        /// <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);
        }
Exemplo n.º 13
0
        /// <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);
        }
Exemplo n.º 14
0
    {/// <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);
        }
Exemplo n.º 15
0
        /// <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);
        }
Exemplo n.º 16
0
        /// <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);
        }
Exemplo n.º 17
0
        public static int AddWasteToProduct(Entity.WasteToProduct entity)
        {
            int                   iReturn   = 0;
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();
            SqlTransactionHelper  thelper   = new SqlTransactionHelper(DAL.Config.con);
            IDbTransaction        trans     = thelper.StartTransaction();

            try
            {
                IDbDataParameter[] prams =
                {
                    dbFactory.MakeInParam("@FromPondID",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.FromPondID.GetType().ToString()),    entity.FromPondID,    32),
                    dbFactory.MakeInParam("@FromWasteCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.FromWasteCode.GetType().ToString()), entity.FromWasteCode, 20),
                    dbFactory.MakeInParam("@DateTime",      DBTypeConverter.ConvertCsTypeToOriginDBType(entity.DateTime.GetType().ToString()),      entity.DateTime,       0),
                    dbFactory.MakeInParam("@FromAmount",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.FromAmount.GetType().ToString()),    entity.FromAmount,    10),
                    dbFactory.MakeInParam("@HanderManID",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.HanderManID.GetType().ToString()),   entity.HanderManID,   32),
                    dbFactory.MakeInParam("@ReceiverID",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ReceiverID.GetType().ToString()),    entity.ReceiverID,    32),
                    dbFactory.MakeInParam("@CreateDate",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CreateDate.GetType().ToString()),    entity.CreateDate,     0),
                    dbFactory.MakeInParam("@CreateUser",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CreateUser.GetType().ToString()),    entity.CreateUser,    50),
                    dbFactory.MakeInParam("@UpdateDate",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateDate.GetType().ToString()),    entity.UpdateDate,     0),
                    dbFactory.MakeInParam("@UpdateUser",    DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateUser.GetType().ToString()),    entity.UpdateUser,    50),
                    dbFactory.MakeInParam("@Status",        DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()),        entity.Status,        32),
                    dbFactory.MakeOutReturnParam()
                };
                iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_WasteToProduct_Add", prams);
                iReturn = int.Parse(prams[11].Value.ToString());
                thelper.CommitTransaction(trans);
                iReturn = 1;
            }
            catch (Exception ex)
            {
                thelper.RollTransaction(trans);
                iReturn = 0;
            }
            finally
            {
                db.Conn.Close();
            }
            return(iReturn);
        }
Exemplo n.º 18
0
        /// <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);
        }
Exemplo n.º 19
0
        /// <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);
        }
Exemplo n.º 20
0
        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="DateTime">    </param>
        ///// <returns></returns>
        //public static List<Entity.FinalWasteLog> GetSumFinalWasteLog()
        //{
        //    List<Entity.FinalWasteLog> list = new List<Entity.FinalWasteLog>();
        //    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(FromAmount) as Total,WasteName from vFinalWasteLog where Status=2 and DateTime>='" + Start + "' and DateTime<='" + End + "' group by WasteName", null);
        //        while (dataReader.Read())
        //        {
        //            Entity.FinalWasteLog entity = new Entity.FinalWasteLog();
        //            entity.FromWasteCode = dataReader["WasteName"].ToString();
        //            entity.FromAmount = decimal.Parse(dataReader["Total"].ToString());
        //            list.Add(entity);
        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        db.Conn.Close();
        //    }
        //    return list;
        //}

        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="DateTime">    </param>
        ///// <returns></returns>
        //public static decimal GetPartSumFinalWasteLog(string WasteName)
        //{
        //    decimal sum = 0;
        //    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(FromAmount) as Total,WasteName from vFinalWasteLog where Status=2 and DateTime>='" + Start + "' and DateTime<='" + End + "' 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="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)
        //{
        //    DataTable dt = new DataTable();
        //    DBOperatorBase db = new DataBase();
        //    IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();
        //    try
        //    {
        //        StringBuilder sb = new StringBuilder();
        //        sb.Append("select sum(FromAmount) as Total,WasteName from vFinalWasteLog 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 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="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 GetSumEx(string StartTime, string EndTime)
        //{
        //    DataTable dt = new DataTable();
        //    DBOperatorBase db = new DataBase();
        //    IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();
        //    try
        //    {
        //        StringBuilder sb = new StringBuilder();
        //        sb.Append("select WasteName 废物名称,sum(FromAmount) as 合计 from vFinalWasteLog 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 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="DateTime">    </param>
        ///// <returns></returns>
        //public static decimal GetPartSumFinalWasteLogEx(string WasteName)
        //{
        //    decimal sum = 0;
        //    DBOperatorBase db = new DataBase();
        //    IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();
        //    try
        //    {
        //        IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "select sum(FromAmount) as Total,WasteName from vFinalWasteLog 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;
        //}



        public static int AddFinalWasteLog(Entity.FinalWasteLog entity)
        {
            int                   iReturn   = 0;
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();
            SqlTransactionHelper  thelper   = new SqlTransactionHelper(DAL.Config.con);
            IDbTransaction        trans     = thelper.StartTransaction();

            try
            {
                IDbDataParameter[] prams =
                {
                    dbFactory.MakeInParam("@LogNumber",  DBTypeConverter.ConvertCsTypeToOriginDBType(entity.LogNumber.GetType().ToString()),  entity.LogNumber,  32),
                    dbFactory.MakeInParam("@DateTime",   DBTypeConverter.ConvertCsTypeToOriginDBType(entity.DateTime.GetType().ToString()),   entity.DateTime,    0),
                    dbFactory.MakeInParam("@IYear",      DBTypeConverter.ConvertCsTypeToOriginDBType(entity.IYear.GetType().ToString()),      entity.IYear,      32),
                    dbFactory.MakeInParam("@Number",     DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Number.GetType().ToString()),     entity.Number,     32),
                    dbFactory.MakeInParam("@UserID",     DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UserID.GetType().ToString()),     entity.UserID,     32),
                    dbFactory.MakeInParam("@CreateDate", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CreateDate.GetType().ToString()), entity.CreateDate,  0),
                    dbFactory.MakeInParam("@CreateUser", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CreateUser.GetType().ToString()), entity.CreateUser, 50),
                    dbFactory.MakeInParam("@UpdateDate", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateDate.GetType().ToString()), entity.UpdateDate,  0),
                    dbFactory.MakeInParam("@UpdateUser", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateUser.GetType().ToString()), entity.UpdateUser, 50),
                    dbFactory.MakeInParam("@Status",     DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()),     entity.Status,     32),
                    dbFactory.MakeOutReturnParam()
                };
                iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_FinalWasteLog_Add", prams);
                iReturn = int.Parse(prams[10].Value.ToString());
                thelper.CommitTransaction(trans);
                iReturn = 1;
            }
            catch (Exception ex)
            {
                thelper.RollTransaction(trans);
                iReturn = 0;
            }
            finally
            {
                db.Conn.Close();
            }
            return(iReturn);
        }
Exemplo n.º 21
0
        /// <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;
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        public static int AddPondChange(Entity.PondChange entity, decimal Capacity)
        {
            int                   iReturn   = 0;
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();
            SqlTransactionHelper  thelper   = new SqlTransactionHelper(DAL.Config.con);
            IDbTransaction        trans     = thelper.StartTransaction();

            try
            {
                IDbDataParameter[] prams =
                {
                    dbFactory.MakeInParam("@PondID",     DBTypeConverter.ConvertCsTypeToOriginDBType(entity.PondID.GetType().ToString()),     entity.PondID,     32),
                    dbFactory.MakeInParam("@OldAmount",  DBTypeConverter.ConvertCsTypeToOriginDBType(entity.OldAmount.GetType().ToString()),  entity.OldAmount,  10),
                    dbFactory.MakeInParam("@NewAmount",  DBTypeConverter.ConvertCsTypeToOriginDBType(entity.NewAmount.GetType().ToString()),  entity.NewAmount,  10),
                    dbFactory.MakeInParam("@Remark",     DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Remark.GetType().ToString()),     entity.Remark,      0),
                    dbFactory.MakeInParam("@CreateDate", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CreateDate.GetType().ToString()), entity.CreateDate,  0),
                    dbFactory.MakeInParam("@CreateUser", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CreateUser.GetType().ToString()), entity.CreateUser, 50)
                };
                iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_PondChange_Add", prams);
                //
                decimal Used   = entity.NewAmount;
                decimal Remain = Capacity - entity.NewAmount;
                iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update	[Pond] set Used='"+ Used + "',Remain='" + Remain + "' where PondID='" + entity.PondID + "'", null);
                thelper.CommitTransaction(trans);
                iReturn = 1;
            }
            catch (Exception ex)
            {
                thelper.RollTransaction(trans);
                iReturn = 0;
            }
            finally
            {
                db.Conn.Close();
            }
            return(iReturn);
        }
Exemplo n.º 24
0
        /// <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);
        }
Exemplo n.º 25
0
        /// <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);
        }
Exemplo n.º 26
0
        /// <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);
        }
Exemplo n.º 27
0
        /// <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);
        }
Exemplo n.º 28
0
        /// <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);
        }
Exemplo n.º 29
0
        /// <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);
        }
Exemplo n.º 30
0
        /// <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);
        }