Пример #1
0
        public List <FeeInfo> GetReportCanSelectFeeList(string reportID)
        {
            String         sql = String.Format(@"SELECT * FROM {0} WHERE ISNULL(PARENT_ID,'')='' AND use_flag=0 AND {3} NOT IN (SELECT {3} FROM {1} WHERE {4} ='{2}') ORDER BY {5}", FeeInfoDBConst.TableName, ReportFeeDBConst.TableName, reportID, FeeInfoDBConst.FeeID, ReportInfoDBConst.ReportID, FeeInfoDBConst.FeeCode);
            DataTable      dt  = _DataHelper.GetDataTable(sql);
            List <FeeInfo> resultFeeInfoList = new List <FeeInfo>();

            for (Int32 i = 0; i < dt.Rows.Count; i++)
            {
                FeeInfo info = new FeeInfo();
                ORMapping.DataRowToObject(dt.Rows[i], info);
                resultFeeInfoList.Add(info);
            }
            List <FeeInfo> childrenFeeInfoList = new List <FeeInfo>();

            foreach (FeeInfo feeInfo in resultFeeInfoList)
            {
                childrenFeeInfoList.AddRange(GetReportFeeChildrenInfoList(reportID, feeInfo));
            }
            resultFeeInfoList.AddRange(childrenFeeInfoList);

            //String sql = String.Format(@"SELECT * FROM {0} WHERE use_flag=0 AND {3} NOT IN (SELECT {3} FROM {1} WHERE {4} ='{2}') ORDER BY {5}", FeeInfoDBConst.TableName, ReportFeeDBConst.TableName, reportID, FeeInfoDBConst.FeeID, ReportInfoDBConst.ReportID, FeeInfoDBConst.FeeCode);
            //DataTable dt = _DataHelper.GetDataTable(sql);
            //List<FeeInfo> result = new List<FeeInfo>();
            //for (Int32 i = 0; i < dt.Rows.Count; i++)
            //{
            //    FeeInfo info = new FeeInfo();
            //    ORMapping.DataRowToObject(dt.Rows[i], info);
            //    result.Add(info);
            //}
            return(resultFeeInfoList);
        }
Пример #2
0
        public WfProcessDescriptorInfoCollection LoadWfProcessDescriptionInfos(Action <WhereSqlClauseBuilder> action, bool ignoreProcessData)
        {
            action.NullCheck("action");

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendTenantCode();
            action(builder);

            string sqlFieldStr = ignoreProcessData ? ORMapping.GetSelectFieldsNameSql <WfProcessDescriptorInfo>("DATA") : "*";

            string sql = string.Format("SELECT {0} FROM WF.PROCESS_DESCRIPTORS WHERE {1}",
                                       sqlFieldStr, builder.ToSqlString(TSqlBuilder.Instance));

            WfProcessDescriptorInfoCollection result = new WfProcessDescriptorInfoCollection();

            DataTable table = DbHelper.RunSqlReturnDS(sql, this.GetConnectionName()).Tables[0];

            foreach (DataRow row in table.Rows)
            {
                WfProcessDescriptorInfo wfProcessDescInfo = new WfProcessDescriptorInfo();
                ORMapping.DataRowToObject(row, wfProcessDescInfo);

                result.Add(wfProcessDescInfo);
            }

            return(result);
        }
Пример #3
0
        private void LoadDataViewRemoveDuplicateData(DataView view)
        {
            Dictionary <string, int> indexDict = new Dictionary <string, int>(view.Count);

            int index = 0;

            foreach (DataRowView drv in view)
            {
                SCObjectAndRelation data = new SCObjectAndRelation();

                ORMapping.DataRowToObject(drv.Row, data);

                int  existsIndex       = -1;
                bool replacedOrIgnored = false;

                if (indexDict.TryGetValue(data.ID, out existsIndex))
                {
                    //如果当前数据是主职,已存在的是兼职,则替换掉已存在的数据,否则忽略掉
                    if (data.Default && this[existsIndex].Default == false)
                    {
                        this[existsIndex] = data;
                    }

                    replacedOrIgnored = true;
                }

                if (replacedOrIgnored == false)
                {
                    this.Add(data);
                    indexDict.Add(data.ID, index);
                    index++;
                }
            }
        }
Пример #4
0
        public UserTaskCollection LoadUserTasks(Action <WhereSqlClauseBuilder> action)
        {
            action.NullCheck("action");

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            action(builder);

            string sql = string.Format("SELECT * FROM WF.USER_TASK WHERE {0}", builder.ToSqlString(TSqlBuilder.Instance));

            UserTaskCollection result = new UserTaskCollection();

            DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

            foreach (DataRow row in table.Rows)
            {
                UserTask task = new UserTask();

                ORMapping.DataRowToObject(row, task);

                result.Add(task);
            }

            return(result);
        }
Пример #5
0
        public AMSChannelCollection LoadRelativeChannels(string eventID)
        {
            eventID.CheckStringIsNullOrEmpty("eventID");

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem("EC.EventID", eventID);

            string sql = string.Format("SELECT C.*, EC.EventID, EC.DefaultPlaybackUrl, EC.CDNPlaybackUrl, EC.IsDefault FROM AMS.Channels C INNER JOIN AMS.EventsChannels EC ON C.ID = EC.ChannelID WHERE {0} ORDER BY EC.IsDefault DESC",
                                       builder.ToSqlString(TSqlBuilder.Instance));

            DataTable table = DbHelper.RunSqlReturnDS(sql, this.GetConnectionName()).Tables[0];

            AMSChannelCollection channels = new AMSChannelCollection();

            foreach (DataRow row in table.Rows)
            {
                AMSChannelInEvent channel = new AMSChannelInEvent();

                ORMapping.DataRowToObject(row, channel);

                channels.Add(channel);
            }

            return(channels);
        }
Пример #6
0
        public UserTaskCollection LoadUserTasksByActivity(string activityID, Action <InSqlClauseBuilder> action)
        {
            action.NullCheck("action");

            InSqlClauseBuilder builder = new InSqlClauseBuilder();

            action(builder);

            string sql = string.Format("SELECT * FROM WF.USER_TASK WHERE ACTIVITY_ID = {0}",
                                       TSqlBuilder.Instance.CheckUnicodeQuotationMark(activityID));

            if (builder.Count > 0)
            {
                sql += " AND " + builder.ToSqlStringWithInOperator(TSqlBuilder.Instance);
            }

            UserTaskCollection result = new UserTaskCollection();

            DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

            foreach (DataRow row in table.Rows)
            {
                UserTask task = new UserTask();

                ORMapping.DataRowToObject(row, task);

                result.Add(task);
            }

            return(result);
        }
        /// <summary>
        /// 根据模式类型,查询ID类型和ID和时间点检索对象
        /// </summary>
        /// <param name="schemaType">表示模式类型的字符串</param>
        /// <param name="idType">表示ID类型的<see cref="SnapshotQueryIDType"/>值之一</param>
        /// <param name="id">对象的ID</param>
        /// <param name="timePoint"></param>
        /// <returns></returns>
        public DESchemaObjectBase LoadByID(string schemaType, DESnapshotQueryIDType idType, string id, DateTime timePoint)
        {
            schemaType.CheckStringIsNullOrEmpty("schemaType");
            id.CheckStringIsNullOrEmpty("id");

            DESchemaDefine schema = DESchemaDefine.GetSchema(schemaType);

            var timeConditon = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder(timePoint, "SN.");

            WhereSqlClauseBuilder whereBuilder = new WhereSqlClauseBuilder();

            EnumItemDescriptionAttribute attr = EnumItemDescriptionAttribute.GetAttribute(idType);

            whereBuilder.AppendItem("SN." + attr.ShortName, id);

            string sql = string.Format("SELECT SO.* FROM DE.SchemaObject SO INNER JOIN {0} SN ON SO.ID = SN.ID WHERE {1}",
                                       schema.SnapshotTable, new ConnectiveSqlClauseCollection(whereBuilder, timeConditon).ToSqlString(TSqlBuilder.Instance));

            DataTable table = DbHelper.RunSqlReturnDS(sql, this.GetConnectionName()).Tables[0];

            DESchemaObjectBase result = null;

            if (table.Rows.Count > 0)
            {
                result = SchemaExtensions.CreateObject(schemaType);

                result.FromString((string)table.Rows[0]["Data"]);
                ORMapping.DataRowToObject(table.Rows[0], result);
            }

            return(result);
        }
        internal List <MonthlyReportDetail> GetMonthlyReportDetailList(Guid SystemID, int Year, int Month, Guid MonthlyReportID, Guid TargetPlanID, Guid SystemBatchID, bool IsAll)
        {
            DataSet ds  = new DataSet();
            string  sql = "GetMonthlyReportDetailList ";

            if (!IsAll)
            {
                sql = "GetMonthlyReportDetailListMonthID";
                ds  = DbHelper.RunSPReturnDS(sql, ConnectionName, CreateSqlParameter("@MonthlyReportID", DbType.Guid, MonthlyReportID));
            }
            else
            {
                ds = DbHelper.RunSPReturnDS(sql, ConnectionName, CreateSqlParameter("@SystemID", DbType.Guid, SystemID), CreateSqlParameter("@FinYear", DbType.Int32, Year), CreateSqlParameter("@FinMonth", DbType.Int32, Month), CreateSqlParameter("@TargetPlanID", DbType.Guid, TargetPlanID), CreateSqlParameter("@SystemBatchID", DbType.Guid, SystemBatchID));
            }
            List <MonthlyReportDetail> data = new List <MonthlyReportDetail>();

            ds.Tables[0].Rows.Cast <System.Data.DataRow>().ForEach(row =>
            {
                MonthlyReportDetail item = new MonthlyReportDetail();
                ORMapping.DataRowToObject(row, item);
                item.NDisplayRateByYear = item.NPlanAmmountByYear == 0 ? "--" : Math.Round((item.NAccumulativeActualAmmount / item.NPlanAmmountByYear), 5, MidpointRounding.AwayFromZero).ToString("P1");
                data.Add(item);
            });
            return(data);
        }
Пример #9
0
        protected TCollection QueryData(string sql)
        {
            Dictionary <string, object> context = new Dictionary <string, object>();

            TCollection result = new TCollection();

            DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

            ORMappingItemCollection mapping = GetMappingInfo(context);

            foreach (DataRow row in table.Rows)
            {
                T data = CreateNewData();

                ORMapping.DataRowToObject(row, mapping, data);

                if (data is ILoadableDataEntity)
                {
                    ((ILoadableDataEntity)data).Loaded = true;
                }

                result.Add(data);
            }

            return(result);
        }
        /// <summary>
        /// 根据orgID获取用户信息
        /// </summary>
        /// <param name="orgid">wd_org.orgID</param>
        /// <returns></returns>
        public PartlyCollection <WD_User> GetSearchOrgUser(string orgid)
        {
            PartlyCollection <WD_User> result = new PartlyCollection <WD_User>();
            string sqlCommand = string.Empty;

            if (orgid != null)
            {
                sqlCommand = string.Format(@"
                    SELECT b.employeeCode as Wd_UserID,b.username as LoginName,b.employeeName as Name,
                    b.orgName as OrgName,b.orgID as Wd_OrgID,b.jobID as JobID,b.joinUnitDate as StartTime, NULL as EndTime,
                    b.jobName as JobTitle
                    FROM dbo.wd_user_org_rel a
                    INNER JOIN dbo.Wd_User b ON a.username = b.username
                    WHERE b.unitID ='{0}' AND a.username IS NOT NULL and b.employeeStatus='2'", SqlTextHelper.SafeQuote(orgid));
                DataSet ds = DbHelper.RunSqlReturnDS(sqlCommand, ConnectionName);
                if (ds != null)
                {
                    DataTable table = ds.Tables[0];
                    if (table != null && table.Rows.Count > 0)
                    {
                        foreach (DataRow row in table.Rows)
                        {
                            WD_User view = new WD_User();
                            ORMapping.DataRowToObject <WD_User>(row, view);
                            result.Add(view);
                        }
                    }
                }
            }
            return(result);
        }
        internal IList <MonthlyReportVM> GetBVMonthlyReport(Guid MonthlyReportID)
        {
            string                 sql = @"
SELECT  TargetID ,
        B_MonthlyReportDetail.SystemID ,
        CompanyID ,
        CompanyName ,
        B_MonthlyReportDetail.CompanyProperty1 ,
        IsMissTarget ,
        Counter ,
        IsMissTargetCurrent ,
        NAccumulativeActualAmmount
FROM    dbo.B_MonthlyReportDetail
        LEFT JOIN dbo.C_Company ON C_Company.ID = B_MonthlyReportDetail.CompanyID
WHERE   MonthlyReportID = @MonthlyReportID
        AND B_MonthlyReportDetail.IsDeleted = 0
        AND C_Company.IsDeleted = 0";
            SqlParameter           pTMonthlyReportID = CreateSqlParameter("@MonthlyReportID", System.Data.DbType.Guid, MonthlyReportID);
            var                    ds   = DbHelper.RunSqlReturnDS(sql, ConnectionName, pTMonthlyReportID);
            List <MonthlyReportVM> data = new List <MonthlyReportVM>();

            ds.Tables[0].Rows.Cast <System.Data.DataRow>().ForEach(row =>
            {
                MonthlyReportVM item = new MonthlyReportVM();
                ORMapping.DataRowToObject(row, item);
                data.Add(item);
            });
            return(data);
        }
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="keyword">用户名称</param>
        /// <param name="deptName">部门名称</param>
        /// <param name="jobName">岗位名称</param>
        /// <returns></returns>
        public PartlyCollection <WD_User> GetSearchOrgUsers(string keyword, string deptName, string jobName)
        {
            PartlyCollection <WD_User> result = new PartlyCollection <WD_User>();
            string sqlCommand = string.Empty;

            {
                sqlCommand = string.Format(@"SELECT DISTINCT  TOP(100) b.employeeCode as Wd_UserID,b.username as LoginName,b.employeeName as Name,
                                            b.orgName as OrgName,b.orgID as Wd_OrgID,b.jobID as JobID,b.joinUnitDate as StartTime, NULL as EndTime,
                                            b.jobName as JobTitle
                                            FROM dbo.Wd_User b
                                            WHERE (b.username LIKE '%{0}%' or b.employeeName LIKE '%{0}%')
                                            and b.unitName LIKE '%{1}%'
                                            and b.jobName LIKE '%{2}%' and b.employeeStatus='2'",
                                           string.IsNullOrEmpty(keyword) == false ? SqlTextHelper.SafeQuote(keyword) : keyword,
                                           string.IsNullOrEmpty(deptName) == false ? SqlTextHelper.SafeQuote(deptName) : deptName,
                                           string.IsNullOrEmpty(jobName) == false ? SqlTextHelper.SafeQuote(jobName) : jobName);

                DataSet ds = DbHelper.RunSqlReturnDS(sqlCommand, ConnectionName);
                if (ds != null)
                {
                    DataTable table = ds.Tables[0];
                    if (table != null && table.Rows.Count > 0)
                    {
                        foreach (DataRow row in table.Rows)
                        {
                            WD_User view = new WD_User();
                            ORMapping.DataRowToObject <WD_User>(row, view);
                            result.Add(view);
                        }
                    }
                }
            }
            return(result);
        }
        /// <summary>
        /// 根据当前的Org信息,获取子节点
        /// </summary>
        /// <param name="orgs">如果参数为null,则返回顶级列表</param>
        /// <returns></returns>
        public PartlyCollection <WdOrg> GetChildOrg(WdOrg orgs = null)
        {
            PartlyCollection <WdOrg> result = new PartlyCollection <WdOrg>();
            string sqlCommand = string.Empty;

            if (orgs == null)
            {
                sqlCommand = "SELECT parentUnitID  ParentID,OrgID, OrgName,ShortName,[order] OrderID, FullPath FROM dbo.wd_org WHERE isRoot = 1  AND  parentStatus = 1 ORDER BY [order]";
            }
            else
            {
                sqlCommand = string.Format("SELECT parentUnitID  ParentID,OrgID, OrgName,ShortName,[order] OrderID FROM dbo.wd_org WHERE parentUnitID = {0}  AND  parentStatus = 1 ORDER BY [order]", orgs.OrgID);;
            }
            DataSet ds = DbHelper.RunSqlReturnDS(sqlCommand, ConnectionName);

            if (ds != null)
            {
                DataTable table = ds.Tables[0];
                if (table != null && table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        WdOrg view = new WdOrg();
                        ORMapping.DataRowToObject <WdOrg>(row, view);
                        result.Add(view);
                    }
                }
            }
            return(result);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="mapping"></param>
        /// <param name="table"></param>
        /// <param name="createNewAction"></param>
        /// <returns></returns>
        public TCollection DataTableToCollection(ORMappingItemCollection mapping, DataTable table, Func <DataRow, T> createNewAction)
        {
            createNewAction.NullCheck("createNewAction");

            TCollection result = new TCollection();

            foreach (DataRow row in table.Rows)
            {
                T data = default(T);

                if (createNewAction != null)
                {
                    data = createNewAction(row);
                }

                ORMapping.DataRowToObject(row, mapping, data);

                if (data is ILoadableDataEntity)
                {
                    ((ILoadableDataEntity)data).Loaded = true;
                }

                result.Add(data);
            }

            return(result);
        }
Пример #15
0
        public SOARolePropertyDefinitionCollection LoadByRoleID(string roleID)
        {
            roleID.CheckStringIsNullOrEmpty("roleID");

            string sql = string.Format("SELECT * FROM WF.ROLE_PROPERTIES_DEFINITIONS WHERE {0} ORDER BY SORT_ORDER",
                                       roleID.ToRoleIDCriteria());

            using (TransactionScope scope = TransactionScopeFactory.Create(TransactionScopeOption.Suppress))
            {
                DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

                SOARolePropertyDefinitionCollection result = new SOARolePropertyDefinitionCollection();

                foreach (DataRow row in table.Rows)
                {
                    SOARolePropertyDefinition property = new SOARolePropertyDefinition();

                    ORMapping.DataRowToObject(row, property);

                    result.Add(property);
                }

                return(result);
            }
        }
Пример #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="openID"></param>
        /// <returns></returns>
        public OpenIDBinding GetBindingByOpenID(string openID)
        {
            ExceptionHelper.CheckStringIsNullOrEmpty(openID, "openID");

            ORMappingItemCollection mappings = ORMapping.GetMappingInfo(typeof(OpenIDBinding));

            string sql = string.Format("SELECT * FROM {0} WHERE OPEN_ID = {1}",
                                       mappings.TableName,
                                       TSqlBuilder.Instance.CheckUnicodeQuotationMark(openID));

            DataTable table;

            using (DbContext context = DbContext.GetContext(DataAdapter.DBConnectionName))
            {
                Database db = DatabaseFactory.Create(DataAdapter.DBConnectionName);

                table = db.ExecuteDataSet(CommandType.Text, sql).Tables[0];
            }

            OpenIDBinding binding = null;

            if (table.Rows.Count > 0)
            {
                binding = new OpenIDBinding();

                ORMapping.DataRowToObject(table.Rows[0], binding);
            }

            return(binding);
        }
        public void LoadFromDataReader(DataView dataView)
        {
            Dictionary <string, DynamicEntity> schemaElements = new Dictionary <string, DynamicEntity>(StringComparer.OrdinalIgnoreCase);

            DynamicEntity dynamicEntity = null;

            DataTable table = dataView.ToTable();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                string entityCode = table.Rows[i]["EntityCode"].ToString();
                string data       = table.Rows[i]["Data"].ToString();

                if (schemaElements.TryGetValue(entityCode, out dynamicEntity) == false)
                {
                    dynamicEntity = DESchemaObjectAdapter.Instance.Load(entityCode) as DynamicEntity;
                    schemaElements.Add(entityCode, dynamicEntity);
                }

                if (dynamicEntity != null)
                {
                    T obj = (T)dynamicEntity.CreateInstance();

                    obj.FromString(data);

                    ORMapping.DataRowToObject(table.Rows[i], obj);

                    if (this.ContainsKey(obj.ID) == false)
                    {
                        this.Add(obj);
                    }
                }
            }
        }
Пример #18
0
        private static DELock Insert(DELock lockData)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append(ORMapping.GetInsertSql(lockData, TSqlBuilder.Instance));
            sql.Append(TSqlBuilder.Instance.DBStatementSeperator);
            sql.AppendFormat("SELECT * FROM {0} WHERE LockID = {1}",
                             GetMappingInfo().TableName,
                             TSqlBuilder.Instance.CheckUnicodeQuotationMark(lockData.LockID));

            DELock result = null;

            try
            {
                DataTable table = DbHelper.RunSqlReturnDS(sql.ToString(), GetConnectionName()).Tables[0];

                result = new DELock();

                ORMapping.DataRowToObject(table.Rows[0], GetMappingInfo(), result);
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                if (ex.Number != 2627)
                {
                    throw;
                }
            }

            return(result);
        }
Пример #19
0
        protected override void OnDataRowToObject(MemberCollection dataCollection, System.Data.DataRow row)
        {
            Member data = new Member();
            ORMappingItemCollection mapping = GetMappingInfo();

            ORMapping.DataRowToObject(row, mapping, data);
            data.GroupName = row["Name"].ToString();
            dataCollection.Add(data);
        }
Пример #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dataCollection"></param>
        /// <param name="row"></param>
        protected virtual void OnDataRowToObject(TCollection dataCollection, DataRow row)
        {
            T data = new T();

            ORMappingItemCollection mapping = GetMappingInfo();

            ORMapping.DataRowToObject(row, mapping, data);

            dataCollection.Add(data);
        }
Пример #21
0
        private static void DataRowToEmailMessage(DataRow row, EmailMessage message)
        {
            ORMapping.DataRowToObject(row, message);

            message.BodyEncoding    = message.BodyEncoding.FromDescription(row["BODY_ENCODING"].ToString());
            message.HeadersEncoding = message.HeadersEncoding.FromDescription(row["HEADERS_ENCODING"].ToString());
            message.SubjectEncoding = message.SubjectEncoding.FromDescription(row["SUBJECT_ENCODING"].ToString());

            message.Loaded = true;
        }
Пример #22
0
        /// <summary>
        /// 获取可比公司数量o
        /// </summary>
        /// <param name="FinYear"></param>
        /// <param name="FinMonth"></param>
        /// <param name="SystemID"></param>
        /// <returns></returns>
        public IList <ContrastAllCompanyVM> GetContrastCompanyTotal(int FinYear, int FinMonth, Guid ID, Guid TargetID, bool IfNow)
        {
            string sql = "";

            if (IfNow == true)
            {
                sql = @"SELECT  CompanyID  ,
        CompanyName
FROM    dbo.C_Company
        RIGHT JOIN dbo.B_MonthlyReportDetail ON B_MonthlyReportDetail.CompanyID = C_Company.ID
WHERE   B_MonthlyReportDetail.IsDeleted = 0
        AND C_Company.IsDeleted = 0
        AND MonthlyReportID = @ID
		AND TargetID=@TargetID
        AND C_Company.ID NOT IN ( SELECT    CompanyID
                                  FROM      dbo.C_ExceptionTarget
                                  WHERE     C_ExceptionTarget.IsDeleted = 0
                                            AND (ExceptionType = 5 OR  ExceptionType = 2) AND TargetID=@TargetID )
	    AND CompanyName NOT LIKE'%总部%'"    ;
            }
            else
            {
                sql = @" SELECT  CompanyID ,
        CompanyName
FROM    dbo.C_Company
        RIGHT JOIN dbo.A_MonthlyReportDetail ON A_MonthlyReportDetail.CompanyID = C_Company.ID
WHERE   A_MonthlyReportDetail.IsDeleted = 0
        AND C_Company.IsDeleted = 0
        AND FinMonth = @FinMonth
        AND FinYear = @FinYear
        AND A_MonthlyReportDetail.SystemID = @ID
		AND TargetID=@TargetID
        AND C_Company.ID NOT IN ( SELECT    CompanyID
                                  FROM      dbo.C_ExceptionTarget
                                  WHERE     C_ExceptionTarget.IsDeleted = 0
                                            AND (ExceptionType = 5 OR  ExceptionType = 2) AND TargetID=@TargetID)
        AND CompanyName NOT LIKE'%总部%'";
            }


            SqlParameter pSystemID           = CreateSqlParameter("@ID", System.Data.DbType.Guid, ID);
            SqlParameter pFinYear            = CreateSqlParameter("@FinYear", System.Data.DbType.Int32, FinYear);
            SqlParameter pFinMonth           = CreateSqlParameter("@FinMonth", System.Data.DbType.Int32, FinMonth);
            SqlParameter pTarget             = CreateSqlParameter("@TargetID", System.Data.DbType.Guid, TargetID);
            var          ds                  = DbHelper.RunSqlReturnDS(sql, ConnectionName, pSystemID, pFinYear, pFinMonth, pTarget);
            List <ContrastAllCompanyVM> data = new List <ContrastAllCompanyVM>();

            ds.Tables[0].Rows.Cast <System.Data.DataRow>().ForEach(row =>
            {
                ContrastAllCompanyVM item = new ContrastAllCompanyVM();
                ORMapping.DataRowToObject(row, item);
                data.Add(item);
            });
            return(data);
        }
Пример #23
0
        internal CheckLockResult(string personID, DataTable table)
            : base(personID)
        {
            if (table.Rows.Count > 0)
            {
                this.currentLock = new Lock();

                ORMapping.DataRowToObject(table.Rows[0], this.currentLock);

                this.currentLockStatus = CalculateLockStatus(personID, (DateTime)table.Rows[0]["CURRENT_TIME"], this.currentLock);
            }
        }
Пример #24
0
        private static void DefaultDataRowToObject <T, TCollection>(TCollection dataCollection, DataRow row)
            where T : new()
            where TCollection : EditableDataObjectCollectionBase <T>, new()
        {
            T data = new T();

            ORMappingItemCollection mapping = ORMapping.GetMappingInfo <T>();

            ORMapping.DataRowToObject(row, mapping, data);

            dataCollection.Add(data);
        }
Пример #25
0
        public void DecryptAmountProperty()
        {
            DataTable table = PrepareTestTable();

            TestObject data = new TestObject();

            ORMapping.DataRowToObject(table.Rows[0], data);

            Console.WriteLine(data.Amount);

            Assert.AreEqual(240000, data.Amount);
        }
Пример #26
0
        public void DecryptSubAmountProperty()
        {
            DataTable table = PrepareContainerTable();

            ContainerObject data = new ContainerObject();

            ORMapping.DataRowToObject(table.Rows[0], data);

            Console.WriteLine(data.SubObject.Amount);

            Assert.AreEqual(240000, data.SubObject.Amount);
        }
Пример #27
0
        public void LoadFromDataView(DataView view)
        {
            foreach (DataRowView drv in view)
            {
                T obj = (T)SchemaExtensions.CreateObject((string)drv["SchemaType"]);

                obj.FromString((string)drv["Data"]);

                ORMapping.DataRowToObject(drv.Row, obj);

                this.Add(obj);
            }
        }
Пример #28
0
        private static SCSimpleObject MapDataRowToSimpleObject(DataRow row)
        {
            SCSimpleObject data = new SCSimpleObject();

            ORMapping.DataRowToObject(row, data);

            if (data.DisplayName.IsNullOrEmpty())
            {
                data.DisplayName = data.Name;
            }

            return(data);
        }
Пример #29
0
        private static SCLock Update(SCLock lockData, bool forceOverride, out bool updated)
        {
            DataSet ds = DbHelper.RunSqlReturnDS(PrepareUpdateData(lockData, forceOverride), GetConnectionName());

            (ds.Tables[1].Rows.Count > 0).FalseThrow("不能找到ID为{0}的锁信息", lockData.LockID);

            updated = (int)ds.Tables[0].Rows[0][0] > 0;

            SCLock result = new SCLock();

            ORMapping.DataRowToObject(ds.Tables[1].Rows[0], GetMappingInfo(), result);

            return(result);
        }
Пример #30
0
        private static EmailAddress GetAddressFromTable(DataTable addressTable, string className)
        {
            DataView view = GetAddressViewByClassName(addressTable, className);

            EmailAddress address = null;

            if (view.Count > 0)
            {
                address = new EmailAddress();
                ORMapping.DataRowToObject(view[0].Row, address);
            }

            return(address);
        }