コード例 #1
0
ファイル: HibernateStoreDao.cs プロジェクト: 5509850/baumax
        private bool LastEmployeeWeekTimeRecPlanUpdate(EmployeeWeekTimeType employeeWeekTime, long storeID, DateTime date)
        {
            string spName;

            switch (employeeWeekTime)
            {
            case EmployeeWeekTimeType.Recording:
                spName = "spStore_LastEmployeeWTRUpdate";
                break;

            case EmployeeWeekTimeType.Planning:
                spName = "spStore_LastEmployeeWTPUpdate";
                break;

            default:
                goto case EmployeeWeekTimeType.Recording;
            }

            int    result;
            string query =
                string.Format(
                    @"declare @res int
exec @res = {0} {1}, '{2}'
select @res result", spName, storeID, date.ToString("yyyyMMdd"));

            result = (int)HibernateTemplate.Execute(
                delegate(ISession session)
            {
                return(session.CreateSQLQuery(query)
                       .AddScalar("result", NHibernateUtil.Int32)
                       .UniqueResult <int>());
            }
                );
            return(result == 0);
        }
コード例 #2
0
ファイル: HibernateStoreDao.cs プロジェクト: 5509850/baumax
        private DateTime?LastEmployeeWeekTimeRecPlanGet(EmployeeWeekTimeType employeeWeekTime, long storeID)
        {
            string spName;
            string resName;

            switch (employeeWeekTime)
            {
            case EmployeeWeekTimeType.Recording:
                spName  = "spStore_LastEmployeeWTRGet";
                resName = "LastEmployeeWTR";
                break;

            case EmployeeWeekTimeType.Planning:
                spName  = "spStore_LastEmployeeWTPGet";
                resName = "LastEmployeeWTP";
                break;

            default:
                goto case EmployeeWeekTimeType.Recording;
            }

            DateTime?result;
            string   query = string.Format("exec {0} :storeID", spName);

            result = (DateTime?)HibernateTemplate.Execute(
                delegate(ISession session)
            {
                return(session.CreateSQLQuery(query)
                       .AddScalar(resName, NHibernateUtil.DateTime)
                       .SetParameter("storeID", storeID)
                       .UniqueResult <DateTime?>());
            }
                );
            return(result);
        }