예제 #1
0
        /// <summary>
        /// 更新密码
        /// </summary>
        /// <param name="intAdminID"></param>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        public int Edit(int intAdminID, string strPassword)
        {
            DbCommand     dbCommandWrapper = null;
            string        strSQL           = @"UPDATE [TB_SystemAdmin] SET [PassWord]=@PassWord
                                                            WHERE [ID]=@ID";
            StringBuilder strBuilder       = new StringBuilder(strSQL);

            try
            {
                Database db = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                db.AddInParameter(dbCommandWrapper, "@ID", DbType.Int32, intAdminID);
                db.AddInParameter(dbCommandWrapper, "@PassWord", DbType.String, strPassword);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                return(db.ExecuteNonQuery(dbCommandWrapper));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #2
0
파일: TB_RoomDAL.cs 프로젝트: radtek/DMdm
        /// <summary>
        /// 获取到DayDormInfo
        /// </summary>
        /// <param name="siteID"></param>
        /// <returns></returns>
        public DataTable GetDayDormInfoBySiteID(int siteID, string startDay, string endDay, string dataType)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        viewTableName = "TB_DayDormReport";
                StringBuilder strBuilder    = new StringBuilder(@"exec Proc_GetDayDormInfo '" + viewTableName + "'," + "N'''" + startDay + "'''," + "N'''" + endDay + "'''," + "'" + dataType + "'");
                Database      db            = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                //strBuilder.AppendLine(" AND A.SiteID = @SiteID");
                //db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, 2);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];



                return(dt);
            }
            catch (Exception ex)
            {
                return(dt);
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #3
0
파일: TB_RoomDAL.cs 프로젝트: radtek/DMdm
        public bool DelTepm(string operatorUser)
        {
            DbCommand dbCommandWrapper = null;

            try
            {
                Database db = DBO.GetInstance();


                string strDelTemp = @"delete from TB_DayRepotTemp where CreateUser='******'";

                dbCommandWrapper = db.GetSqlStringCommand(strDelTemp);
                db.ExecuteNonQuery(dbCommandWrapper);

                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 获取到一个Site的所有宿舍区
        /// </summary>
        /// <param name="siteID"></param>
        /// <returns></returns>
        public DataTable GetTableBySite(int siteID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"select ID
,[SiteID]
      ,[Name]
      ,[Creator] from TB_AllowanceApply where 1=1";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND SiteID = @SiteID");
                db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, siteID);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #5
0
파일: TB_RoomDAL.cs 프로젝트: radtek/DMdm
        /// <summary>
        /// 获取到DormInfo
        /// </summary>
        /// <param name="siteID"></param>
        /// <returns></returns>
        public DataTable GetDormInfoBySiteID(int siteID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                StringBuilder strBuilder = new StringBuilder(@"select * from view_CurrentDormReport");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                //strBuilder.AppendLine(" AND A.SiteID = @SiteID");
                //db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, 2);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                DataRow[] dr       = dt.Select("IsNull([grade],   ' ')   <>   ' '", "areaname,grade,DormNo ");
                DataTable dtReturn = dt.Clone();
                for (int i = 0; i < dr.Length; i++)
                {
                    dtReturn.ImportRow(dr[i]);
                }
                return(dtReturn);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #6
0
파일: TB_UserDAL.cs 프로젝트: radtek/DMdm
        /// <summary>
        /// 根据用户ID获取到用户信息
        /// </summary>
        /// <param name="intUserID"></param>
        /// <returns></returns>
        public TB_User GetUserInfo(int intUserID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"SELECT * FROM [TB_User] WHERE 1=1";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND ID = @ID");
                db.AddInParameter(dbCommandWrapper, "@ID", DbType.Int32, intUserID);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(this.ConvertTableToList(dt).FirstOrDefault());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #7
0
        public DataTable Get(int siteID, string name)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"SELECT top 1 ID FROM TB_BU WHERE SiteID=" + siteID + " and Name= '" + name + "' ";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #8
0
        /// <summary>
        /// 批量启用/禁用
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="bEnable"></param>
        public int ChangeBedEnable(List <int> ids, bool bEnable)
        {
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = string.Format(@"update TB_Bed set IsEnable=@value  WHERE 1=1 ");
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;

                var sids = string.Join(",", ids);
                strBuilder.AppendFormat(" AND ID in ({0})", sids);
                strBuilder.AppendLine();
                string uValue = bEnable ? "已启用" : "已禁用";
                db.AddInParameter(dbCommandWrapper, "@value", DbType.String, uValue);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                return(db.ExecuteNonQuery(dbCommandWrapper));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #9
0
        public bool ChangeBegStatus(int ID)
        {
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = string.Format(@"select status from  TB_Bed   WHERE 1=1 ");
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND id = @id");
                db.AddInParameter(dbCommandWrapper, "@ID", DbType.Int32, ID);

                dbCommandWrapper.CommandText = strBuilder.ToString();
                DataSet ds = db.ExecuteDataSet(dbCommandWrapper);

                return(ds.Tables[0].Rows[0][0].ToString() == "1" ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #10
0
파일: FlexPlusBAL.cs 프로젝트: radtek/DMdm
        public DataTable GetRepairDormList(TB_DormRepair mItem)
        {
            var       sb = new StringBuilder(@"select ID,CName,EmployeeNo,MobileNo,DormAddress,RepairTime,DeviceType,RequireDesc,CreateDate,Status,Response,ModifyUserID,ModifyDate
                                        from TB_DormRepair ");
            var       db = DBO.GetInstance();
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
            dbCommandWrapper.CommandType = CommandType.Text;
            sb.Append("where 1=1 ");

            if (mItem.ID > 0)
            {
                sb.AppendFormat("and id={0} ", mItem.ID);
            }
            if (!string.IsNullOrEmpty(mItem.DeviceType))
            {
                sb.AppendFormat("and DeviceType='{0}' ", mItem.DeviceType);
            }
            if (mItem.Status > -1)
            {
                sb.AppendFormat("and Status='{0}' ", mItem.Status);
            }
            if (mItem.SubmitDayBegin != default(DateTime))
            {
                sb.AppendFormat(" AND CAST(CreateDate as Date) between '{0:yyyy/MM/dd}' and '{1:yyyy/MM/dd}'",
                                mItem.SubmitDayBegin, mItem.SubmitDayEnd);
            }

            sb.Append(" order by CreateDate desc, status");
            dbCommandWrapper.CommandText = sb.ToString();
            dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
            return(dt);
        }
예제 #11
0
파일: FlexPlusBAL.cs 프로젝트: radtek/DMdm
        public DataTable GetDormSuggestList(TB_DormSuggest mItem)
        {
            var       sb = new StringBuilder("select * from TB_DormSuggest ");
            var       db = DBO.GetInstance();
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
            dbCommandWrapper.CommandType = CommandType.Text;
            sb.Append("where 1=1 ");

            if (mItem.ID > 0)
            {
                sb.AppendFormat("and id={0} ", mItem.ID);
            }
            if (mItem.Status > -1)
            {
                sb.AppendFormat("and Status='{0}' ", mItem.Status);
            }
            if (mItem.SubmitDayBegin != default(DateTime))
            {
                sb.AppendFormat(" AND CAST(CreateDate as Date) between '{0:yyyy/MM/dd}' and '{1:yyyy/MM/dd}'",
                                mItem.SubmitDayBegin, mItem.SubmitDayEnd);
            }

            sb.Append(" order by CreateDate desc, status");
            dbCommandWrapper.CommandText = sb.ToString();
            dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
            return(dt);
        }
예제 #12
0
파일: FlexPlusBAL.cs 프로젝트: radtek/DMdm
        public DataTable GetDormNotice(Pager pager)
        {
            var       sb = new StringBuilder("select * from V_TB_DormNotice ");
            var       db = DBO.GetInstance();
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
            dbCommandWrapper.CommandType = CommandType.Text;
            sb.Append("where 1=1 ");

            if (pager != null && !pager.IsNull)
            {
                dbCommandWrapper.CommandText = pager.GetPagerSql4Count(sb.ToString());
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                pager.TotalRecord            = Convert.ToInt32(dt.Rows[0][0]);
                dbCommandWrapper.CommandText = pager.GetPagerSql4Data(sb.ToString(), DataBaseTypeEnum.sqlserver);
            }
            else
            {
                dbCommandWrapper.CommandText = sb.ToString();
            }
            dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
            return(dt);
        }
예제 #13
0
        public DataSet GetTable(TB_Module tb_Module)
        {
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"SELECT * FROM [TB_Module] where 1=1";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND SiteID = @SiteID");
                db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, tb_Module.SiteID);
                strBuilder.AppendLine(" AND [IsActive] = @IsActive");
                db.AddInParameter(dbCommandWrapper, "@IsActive", DbType.Int32, tb_Module.IsActive);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                return(db.ExecuteDataSet(dbCommandWrapper));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #14
0
        public DataSet GetModule(int intRoleID)
        {
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"SELECT A.* FROM [TB_Module] AS A
                                    INNER join [TB_RoleConnectModule] as B
                                    on A.ID=B.[ModuleID]
                                    where 1=1";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND B.RoleID = @RoleID");
                db.AddInParameter(dbCommandWrapper, "@RoleID", DbType.Int32, intRoleID);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                return(db.ExecuteDataSet(dbCommandWrapper));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #15
0
        public int AddAssignDormInfo(TB_AssignDormArea info)
        {
            Database  db = DBO.GetInstance();
            DbCommand dbCommandWrapper = null;
            int       intId;
            string    strInsertSql   = @"INSERT INTO [TB_AssignDormArea] ([DormAreaID]
      ,[CardNo],[EmployeeNo],[CreateUser],[CreateDate]) VALUES(@DormAreaID,@CardNo,@EmployeeNo,@CreateUser,@CreateDate)";
            string    strSelectIdSql = ";SELECT SCOPE_IDENTITY()";

            try
            {
                dbCommandWrapper = db.GetSqlStringCommand(strInsertSql + strSelectIdSql);
                #region Add parameters
                db.AddInParameter(dbCommandWrapper, "@DormAreaID", DbType.Int32, info.DormAreaID);
                db.AddInParameter(dbCommandWrapper, "@CardNo", DbType.String, info.CardNo);
                db.AddInParameter(dbCommandWrapper, "@EmployeeNo", DbType.String, info.EmployeeNo);
                db.AddInParameter(dbCommandWrapper, "@CreateUser", DbType.String, info.CreateUser);
                db.AddInParameter(dbCommandWrapper, "@CreateDate", DbType.DateTime, info.CreateDate);
                #endregion
                intId = Convert.ToInt32(db.ExecuteScalar(dbCommandWrapper));
                return(intId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #16
0
        public int ChangeBegEnable(int ID, string value)
        {
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = string.Format(@"update TB_Bed set IsEnable=@value  WHERE 1=1 ");
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND id = @id");
                db.AddInParameter(dbCommandWrapper, "@ID", DbType.Int32, ID);
                string uValue = value == "已禁用" ? "已启用" : "已禁用";
                db.AddInParameter(dbCommandWrapper, "@value", DbType.String, uValue);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                return(db.ExecuteNonQuery(dbCommandWrapper));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="intUserID"></param>
        /// <returns></returns>
        public DataTable GetTable(int intUserID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"SELECT A.* 
FROM TB_AllowanceApplyCancel AS A
INNER JOIN [TB_UserConnectDormArea] AS B
ON A.ID=B.[DormAreaID]
                                        WHERE B.[UserID]=@UserID";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                db.AddInParameter(dbCommandWrapper, "@UserID", DbType.Int32, intUserID);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #18
0
파일: TB_UnitDAL.cs 프로젝트: radtek/DMdm
        /// <summary>
        /// 获取site的所有单元信息
        /// </summary>
        /// <param name="siteID"></param>
        /// <returns></returns>
        public DataTable GetTableBySite(int siteID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                StringBuilder strBuilder = new StringBuilder(@"SELECT A.*,B.Name AS BuildingName,C.Name AS DormAreaName
                                    FROM [TB_Unit] as A
                                    inner join TB_Building As B
                                    on A.BuildingID=B.ID
                                    inner join TB_DormArea AS C
                                    on A.DormAreaID=C.ID");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND A.SiteID = @SiteID");
                db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, siteID);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #19
0
        public DataTable GetTable(int intSiteID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"SELECT * FROM TB_BU WHERE 1=1 ";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND SiteID = @SiteID");
                db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, intSiteID);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #20
0
        /// <summary>
        /// 获取到一个site的所有入住人员信息
        /// </summary>
        /// <param name="intSiteID"></param>
        /// <returns></returns>
        public DataTable GetTableBySiteID(int intSiteID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @" SELECT A.ID,A.CardNo,A.IsActive,EmployeeNo 
	                                    from [TB_EmployeeCheckIn] as A where A.[SiteID]=@SiteID"    ;
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.String, intSiteID);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper.Dispose();
                    dbCommandWrapper = null;
                }
            }
        }
예제 #21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="intUserID"></param>
        /// <returns></returns>
        public DataTable GetTable(string EmployeeNo)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"SELECT A.* 
                                FROM TB_AllowanceApply AS A 
                                WHERE A.[EmployeeNo]=@EmployeeNo";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                db.AddInParameter(dbCommandWrapper, "@EmployeeNo", DbType.String, EmployeeNo);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #22
0
        /// <summary>
        /// 根据ID查询入住记录
        /// </summary>
        /// <param name="intID"></param>
        /// <returns></returns>
        public DataTable Get(int intID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"  SELECT A.*
	                                    from [TB_EmployeeCheckIn] as A where A.ID=@ID"    ;
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                db.AddInParameter(dbCommandWrapper, "@ID", DbType.Int32, intID);
                strBuilder.AppendLine(" AND A.IsActive = @IsActive");
                db.AddInParameter(dbCommandWrapper, "@IsActive", DbType.Int32, (int)TypeManager.IsActive.Valid);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper.Dispose();
                    dbCommandWrapper = null;
                }
            }
        }
예제 #23
0
        public DataTable GetTableMonthByEmployeeNo(string EmployeeNo)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"SELECT * from [TB_Charging] as A where 1=1";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND A.EmployeeNo = @EmployeeNo And DATEDIFF(MM,A.CreateTime,GETDATE())=0");
                db.AddInParameter(dbCommandWrapper, "@EmployeeNo", DbType.String, EmployeeNo);

                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #24
0
        public DataTable GetTable(TB_AssignRoom info)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"select [ID]
      ,[RoomID]
      ,[isActive]
      ,[BedID]
      ,[SiteID] from [TB_AssignRoom] where 1=1";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND SiteID = @SiteID");
                db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, info.SiteID);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #25
0
파일: TB_RoomDAL.cs 프로젝트: radtek/DMdm
        /// <summary>
        /// 获取日期的连续数据
        /// </summary>
        /// <param name="siteID"></param>
        /// <returns></returns>
        public DataTable GetALLCheckInByDate(string strDay)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                StringBuilder strBuilder = new StringBuilder(@"SELECT COUNT(1) COUNT from TB_EmployeeCheckIn where CheckInDate<='" + strDay + " 23:59:59" + "'");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                //strBuilder.AppendLine(" AND A.SiteID = @SiteID");
                //db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, 2);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];

                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #26
0
        public DataTable GetAssignDormInfo(string IDCardNo)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                StringBuilder strBuilder = new StringBuilder(@"select * from TB_AssignDormArea where ");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" CardNo=@IDCardNo ");
                db.AddInParameter(dbCommandWrapper, "@IDCardNo", DbType.String, IDCardNo);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #27
0
파일: TB_RoomDAL.cs 프로젝트: radtek/DMdm
        /// <summary>
        /// 获取到DayDormInfo
        /// </summary>
        /// <param name="siteID"></param>
        /// <returns></returns>
        public DataTable GetMonthDormInfoBySiteID(int siteID, string startDay, string projectName, string dataType)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                startDay = startDay + "-01 00:00:00";
                StringBuilder strBuilder = new StringBuilder(@"Select Areaname,Roomtypt,'" + projectName + @"' project,cast(AVG(" + dataType + @") as decimal(18,1)) 平均,MAX(" + dataType + @") 最大,MIN(" + dataType + @") 最小 From TB_DayDormReport 
                                            Where YEAR(Createdate)= YEAR('" + startDay + @"') and Month([Createdate]) = Month('" + startDay + @"') 
                                            GROUP BY Areaname,Roomtypt");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                //strBuilder.AppendLine(" AND A.SiteID = @SiteID");
                //db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, 2);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];

                return(dt);
            }
            catch (Exception ex)
            {
                return(dt);
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #28
0
        public int DelAssignDormInfo(string IDCardNo)
        {
            DbCommand dbCommandWrapper = null;

            try
            {
                StringBuilder strBuilder = new StringBuilder(@"Delete from TB_AssignDormArea where ");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" CardNo=@IDCardNo ");
                db.AddInParameter(dbCommandWrapper, "@IDCardNo", DbType.String, IDCardNo);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                int i = db.ExecuteNonQuery(dbCommandWrapper);
                return(i);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #29
0
파일: TB_RoomDAL.cs 프로젝트: radtek/DMdm
        /// <summary>
        /// BegCount
        /// </summary>
        /// <param name="siteID"></param>
        /// <returns></returns>
        public DataTable GetBegCountBySiteID(int siteID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                StringBuilder strBuilder = new StringBuilder(@"exec Proc_GetAllBegCount ");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                //strBuilder.AppendLine(" AND A.SiteID = @SiteID");
                //db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, 2);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];

                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
예제 #30
0
        /// <summary>
        /// 获取到超级管理员信息
        /// </summary>
        /// <param name="strAccount"></param>
        /// <param name="strPassWord"></param>
        /// <returns></returns>
        public TB_SystemAdmin GetUserInfo(string strAccount, string strPassWord)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                string        strSQL     = @"select * from [TB_SystemAdmin] where 1=1";
                StringBuilder strBuilder = new StringBuilder(strSQL);
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                strBuilder.AppendLine(" AND Account = @Account");
                db.AddInParameter(dbCommandWrapper, "@Account", DbType.String, strAccount);
                strBuilder.AppendLine(" AND PassWord = @PassWord");
                db.AddInParameter(dbCommandWrapper, "@PassWord", DbType.String, strPassWord);
                dbCommandWrapper.CommandText = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(this.ConvertTableToList(dt).FirstOrDefault());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }