示例#1
0
        internal static Color GetRowColor(this DataRow row)
        {
            if (row == null)
            {
                return(Color.White);
            }

            RowsStates rowState = (RowsStates)(int)row["RowState"];

            return(rowState.GetRowColor());
        }
示例#2
0
        internal Color GetNomenclatureRowColor(DataRow row)
        {
            if (row == null)
            {
                return(Color.White);
            }

            RowsStates rowState = (RowsStates)(int)row[NomenclatureState];

            return(rowState.GetRowColor());
        }
示例#3
0
        internal static Color GetRowColor(this RowsStates rowState)
        {
            switch (rowState)
            {
            case RowsStates.PlannedAcceptance:
                return(StatesColors.Planed);

            case RowsStates.Processing:
                return(StatesColors.Processing);

            case RowsStates.Canceled:
                return(StatesColors.Canceled);

            case RowsStates.Completed:
                return(StatesColors.Completed);
            }

            return(Color.White);
        }
示例#4
0
        internal static void SetRowState(this long databaseObjectId, Type databaseObjectType, long lineNumber, RowsStates newRowState, string fieldName = "RowState", long employee = 0)
        {
            var subtableName = string.Empty;
            var configuration = SystemConfiguration.DBConfigurationTree[databaseObjectType.Name];

            foreach (var tableInfo in configuration.InfoSubTables.Values)
                {
                if (tableInfo.SubtableFields.ContainsKey(fieldName))
                    {
                    subtableName = configuration.GetDatabaseTableName(tableInfo);
                    break;
                    }
                }

            var q = DB.NewQuery(string.Format(@"
            Update top(1) [{0}]
                Set [{1}] = @RowState, Employee = @employee
                where IdDoc = @DatabaseObjectId and LineNumber = @LineNumber", subtableName, fieldName));
            q.AddInputParameter("DatabaseObjectId", databaseObjectId);
            q.AddInputParameter("LineNumber", lineNumber);
            q.AddInputParameter("RowState", (int)newRowState);
            q.AddInputParameter("employee", employee);
            q.Execute();
        }
示例#5
0
        private bool getAcceptanceId(long stickerId, bool setProcessingStatus, out long acceptanceId, out RowsStates rowState, out long cellId)
        {
            var q = DB.NewQuery(@"select top 1 info.IdDoc, info.NomenclatureState [State], info.NomenclatureCell

            from SubAcceptanceOfGoodsNomenclatureInfo info
            join AcceptanceOfGoods a on a.Id = info.IdDoc

            where a.MarkForDeleting = 0 and NomenclatureCode = @StickerCode");

            q.AddInputParameter("StickerCode", stickerId);
            var resultObj = q.SelectRow();

            acceptanceId = 0;
            rowState = RowsStates.PlannedAcceptance;
            cellId = 0;

            if (resultObj != null)
                {
                acceptanceId = Convert.ToInt64(resultObj[0]);
                rowState = (RowsStates)Convert.ToInt32(resultObj[1]);
                cellId = Convert.ToInt64(resultObj[2]);
                }

            bool documentFound = acceptanceId > 0;

            if (documentFound && setProcessingStatus)
                {
                var doc = new AcceptanceOfGoods() { ReadingId = acceptanceId };
                doc.State = StatesOfDocument.Processing;
                doc.Write();
                }

            return documentFound;
        }
示例#6
0
        internal static void SetRowState(this long databaseObjectId, Type databaseObjectType, long lineNumber, RowsStates newRowState, string fieldName = "RowState", long employee = 0)
        {
            var subtableName  = string.Empty;
            var configuration = SystemConfiguration.DBConfigurationTree[databaseObjectType.Name];

            foreach (var tableInfo in configuration.InfoSubTables.Values)
            {
                if (tableInfo.SubtableFields.ContainsKey(fieldName))
                {
                    subtableName = configuration.GetDatabaseTableName(tableInfo);
                    break;
                }
            }

            var q = DB.NewQuery(string.Format(@"
            Update top(1) [{0}] 
                Set [{1}] = @RowState, Employee = @employee
                where IdDoc = @DatabaseObjectId and LineNumber = @LineNumber", subtableName, fieldName));

            q.AddInputParameter("DatabaseObjectId", databaseObjectId);
            q.AddInputParameter("LineNumber", lineNumber);
            q.AddInputParameter("RowState", (int)newRowState);
            q.AddInputParameter("employee", employee);
            q.Execute();
        }