Example #1
0
        protected int GetNewId(CodeTable tab)
        {
            using (TransactionScope tx = new TransactionScope())
            {
                var db = getDB0();
                try
                {
                    string tab_name = Enum.GetName(typeof(CodeTable), tab);
                    var    items    = db.i_IDX.Where(x => x.table_name == tab_name).FirstOrDefault();

                    if (items == null)
                    {
                        return(0);
                    }
                    else
                    {
                        items.IDX++;
                        db.SaveChanges();
                        tx.Complete();
                        return(items.IDX);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    return(0);
                }
                finally
                {
                    db.Dispose();
                }
            }
        }
Example #2
0
        public override void FillCodeTable(IPageStyle style)
        {
            TkDebug.AssertArgumentNull(style, "style", this);

            if (style.Style == PageStyle.List)
            {
                var queryCodeTables = (from field in CurrentSchemeEx.Fields
                                       let tk5Field = field as ITk5FieldInfo
                                                      where IsQueryField(tk5Field)
                                                      select tk5Field.Decoder.RegName).Distinct().ToArray();
                if (queryCodeTables.Length == 0)
                {
                    return;
                }

                InitializeCodeTable(style);
                foreach (string regName in queryCodeTables)
                {
                    CodeTable code = CodeTables.GetFilledCodeTable(regName);
                    if (code != null)
                    {
                        code.Fill(HostDataSet, Context);
                    }
                }
            }
            else
            {
                base.FillCodeTable(style);
            }
        }
Example #3
0
        /// <summary>
        /// Instruction mapping for op codes and such for using in encoding
        /// </summary>
        public InstructionMap()
        {
            table     = CodeTable.DefaultTable;
            firstMap  = new OpcodeMap((int)VCDiffInstructionType.LAST + AddressCache.DefaultLast + 1, FindMaxSize(table.size1));
            secondMap = new OpcodeMap2((int)VCDiffInstructionType.LAST + AddressCache.DefaultLast + 1, FindMaxSize(table.size2));
            for (int opcode = 0; opcode < CodeTable.kCodeTableSize; ++opcode)
            {
                if (table.inst2[opcode] == CodeTable.N)
                {
                    firstMap.Add(table.inst1[opcode], table.size1[opcode], table.mode1[opcode], (byte)opcode);
                }
                else if (table.inst1[opcode] == CodeTable.N)
                {
                    firstMap.Add(table.inst1[opcode], table.size1[opcode], table.mode1[opcode], (byte)opcode);
                }
            }

            for (int opcode = 0; opcode < CodeTable.kCodeTableSize; ++opcode)
            {
                if ((table.inst1[opcode] != CodeTable.N) && (table.inst2[opcode] != CodeTable.N))
                {
                    int found = LookFirstOpcode(table.inst1[opcode], table.size1[opcode], table.mode1[opcode]);
                    if (found == CodeTable.kNoOpcode)
                    {
                        continue;
                    }
                    secondMap.Add((byte)found, table.inst2[opcode], table.size2[opcode], table.mode2[opcode], (byte)opcode);
                }
            }
        }
Example #4
0
        //This is a window encoder for the VCDIFF format
        //if you are not including a checksum simply pass 0 to checksum
        //it will be ignored
        public WindowEncoder(long dictionarySize, uint checksum, ChecksumFormat checksumFormat, bool interleaved)
        {
            this.Checksum       = checksum;
            this.ChecksumFormat = checksumFormat;
            this.IsInterleaved  = interleaved;
            this.dictionarySize = dictionarySize;

            // The encoder currently doesn't support encoding with a custom table
            // will be added in later since it will be easy as decoding is already implemented
            maxMode         = AddressCache.DefaultLast;
            table           = CodeTable.DefaultTable;
            addrCache       = new AddressCache();
            targetLength    = 0;
            lastOpcodeIndex = -1;
            instrMap        = InstructionMap.Instance;

            //Separate buffers for each type if not interleaved
            if (!interleaved)
            {
                instructionAndSizes = new MemoryStream();
                dataForAddAndRun    = new MemoryStream();
                addressForCopy      = new MemoryStream();
            }
            else
            {
                instructionAndSizes = dataForAddAndRun = addressForCopy = new MemoryStream();
            }
        }
Example #5
0
        public int GetNewId(CodeTable tab)
        {
            int i = 0;

            using (var tx = new TransactionScope())
            {
                var get_id_db = getDB0;

                try
                {
                    string tab_name = Enum.GetName(typeof(ProcCore.Business.CodeTable), tab);
                    var    item     = get_id_db.i_IDX.Where(x => x.table_name == tab_name)
                                      .ToList()
                                      .FirstOrDefault();

                    if (item != null)
                    {
                        item.IDX++;
                        get_id_db.SaveChanges();
                        tx.Complete();
                        i = item.IDX;
                    }
                }
                catch (Exception ex)
                {
                    Log.Write(ex.ToString());
                }
                finally
                {
                    get_id_db.Dispose();
                }
                return(i);
            }
        }
Example #6
0
        public async Task <VmGenericServiceResult> Update(VmCodeTableItem vmCodeTableItem)
        {
            VmGenericServiceResult result = new VmGenericServiceResult();

            try
            {
                CodeTable r = await repo.Get(vmCodeTableItem.Id);

                Copy <VmCodeTableItem, CodeTable>(vmCodeTableItem, r);

                if (r.UpdatedBy.IsNullOrEmpty())
                {
                    r.UpdatedBy = "System";
                }

                repo.Update(r);

                repo.Commit();

                result.IsSuccess = true;
            }
            catch (Exception e)
            {
                result.IsSuccess = false;
                result.Error     = e;
            }

            return(result);
        }
Example #7
0
        public PublicModel(SnsUser user, int cate) : base(user)
        {
            var activityService = ServiceFactory.GetService <IActivityService>();

            ViewRanges = CodeTable.GetCodes(typeof(ViewRange));
            Activities = activityService.GetNewestActivities(user.Id, (ActivityCategory)cate, 0);
        }
Example #8
0
 // Constructor.
 internal DbcsConvert(string fileName)
 {
     using (var table = new CodeTable(fileName)) {
         n2u = table.GetSection(1);
         u2n = table.GetSection(2);
     }
 }
Example #9
0
        public VmGenericServiceResult Insert(VmCodeTableItem vmCodeTableItem)
        {
            VmGenericServiceResult result = new VmGenericServiceResult();

            try
            {
                CodeTable r = new CodeTable();

                Copy <VmCodeTableItem, CodeTable>(vmCodeTableItem, r);

                r.CodeCategory_Id = (int)vmCodeTableItem.CodeCategory_Id;
                if (r.CreatedBy.IsNullOrEmpty())
                {
                    r.CreatedBy = r.UpdatedBy = "System";
                }
                repo.Add(r);

                repo.Commit();

                result.IsSuccess = true;
            }
            catch (Exception e)
            {
                result.IsSuccess = false;
                result.Error     = e;
            }

            return(result);
        }
Example #10
0
      public ActionResult RegisterUser()
      {
          Users user = CMSService.GetUserByUserName(username);



          CodeTable cT = new CodeTable();

          Session["CODETABLE"] = cT;


          viewUser newUser = new viewUser();

          if (user != null)
          {
              if (user.IsActive == true)
              {
                  using (var securityWCFServiceClient = new SecurityWCFServiceClient())
                  {
                      var nav = securityWCFServiceClient.GetDefaultNavigationByRole(applicationname, codeTable.UserRoleName);
                      return(RedirectToAction(nav.ActionName, nav.ControllerName, new { Area = areaname }));
                  }
              }
              else
              {
                  newUser = CMSService.GetUser(user.UserId);
                  newUser.UserContracts = newUser.UserContracts.Where(c => c.EndDate == null).ToList();
                  newUser.IsPending     = true;

                  if (newUser.UserConfidentiality == null || newUser.UserConfidentiality.UserSignatureDate == null)
                  {
                      return(RedirectToAction("UserConfidentiality", "Account", new { @userId = user.UserId }));
                  }
              }
          }
          else
          {
              newUser.UserName = username;

              newUser.Roles             = CMSService.GetRoles();
              newUser.PossibleContracts = CMSService.GetContracts();

              for (int i = 0; i < 3; i++)
              {
                  viewUserContract newContract = new viewUserContract();

                  newUser.UserContracts.Add(newContract);
              }

              newUser.PossiblePSAs = CMSService.GetPSAs();

              newUser.PossibleMCOs = CMSService.GetMCOs();

              newUser.IsAcceptCon = false;
          }



          return(View(newUser));
      }
		// Constructor.
		internal DbcsConvert (string fileName)
		{
			using (var table = new CodeTable (fileName)) {
				n2u = table.GetSection(1);
				u2n = table.GetSection(2);
			}
		}
Example #12
0
        /// <summary>
        /// Reads the custom code table, if there is one
        /// </summary>
        void ReadCodeTable()
        {
            // The length given includes the nearSize and sameSize bytes
            int compressedTableLength = IOHelper.ReadBigEndian7BitEncodedInt(delta) - 2;
            int nearSize = IOHelper.CheckedReadByte(delta);
            int sameSize = IOHelper.CheckedReadByte(delta);

            byte[] compressedTableData = IOHelper.CheckedReadBytes(delta, compressedTableLength);

            byte[] defaultTableData = CodeTable.Default.GetBytes();

            MemoryStream tableOriginal = new MemoryStream(defaultTableData, false);
            MemoryStream tableDelta    = new MemoryStream(compressedTableData, false);

            byte[]       decompressedTableData = new byte[1536];
            MemoryStream tableOutput           = new MemoryStream(decompressedTableData, true);

            VcdiffDecoder.Decode(tableOriginal, tableDelta, tableOutput);

            if (tableOutput.Position != 1536)
            {
                throw new VcdiffFormatException("Compressed code table was incorrect size");
            }

            _codeTable = new CodeTable(decompressedTableData);
            _cache     = new AddressCache(nearSize, sameSize);
        }
Example #13
0
        ScriptTable ParseTable(CodeTable table)
        {
            ScriptContext context = new ScriptContext(m_script, null, this, Executable_Block.None);
            ScriptTable   ret     = m_script.CreateTable();

            foreach (ScriptScriptFunction func in table.Functions)
            {
                func.SetTable(ret);
                ret.SetValue(func.Name, func);
                context.SetVariableForce(func.Name, func);
            }
            foreach (CodeTable.TableVariable variable in table.Variables)
            {
                ScriptObject value = context.ResolveOperand(variable.value);
                if (value is ScriptScriptFunction)
                {
                    ScriptScriptFunction func = (ScriptScriptFunction)value;
                    if (func.IsStaticFunction)
                    {
                        func.SetTable(ret);
                    }
                }
                ret.SetValue(variable.key, value);
                context.SetVariableForce(variable.key.ToString(), value);
            }
            return(ret);
        }
Example #14
0
        public ActionResult <ApiResult <bool> > SaveCodetableImport([FromForm] int dbid, [FromForm] string model)
        {
            ApiResult <bool> result = new ApiResult <bool>();
            var list       = Newtonsoft.Json.JsonConvert.DeserializeObject <List <DbTableGridViewModel> >(model);
            var tableDb    = base.GetTryDb(dbid);
            var systemDb   = Db;
            var type       = CodeTypeDb.GetList();
            var entityList = CodeTableDb.GetList(it => it.DbId == dbid);

            systemDb.BeginTran();
            try
            {
                List <CodeTable> Inserts = new List <CodeTable>();
                foreach (var item in list)
                {
                    CodeTableViewModel code = new CodeTableViewModel()
                    {
                        ClassName      = PubMehtod.GetCsharpName(item.Name),
                        TableName      = item.Name,
                        DbId           = dbid,
                        Description    = item.Description,
                        ColumnInfoList = new List <CodeColumnsViewModel>()
                    };
                    var entity = entityList.FirstOrDefault(it => it.TableName.Equals(item.Name, StringComparison.OrdinalIgnoreCase));
                    if (entity == null)
                    {
                        entity = new CodeTable();
                    }
                    foreach (var columnInfo in tableDb.DbMaintenance.GetColumnInfosByTableName(item.Name, false))
                    {
                        var typeInfo = GetEntityType(type, columnInfo, this, tableDb.CurrentConnectionConfig.DbType);
                        CodeColumnsViewModel column = new CodeColumnsViewModel()
                        {
                            ClassProperName = PubMehtod.GetCsharpName(columnInfo.DbColumnName),
                            DbColumnName    = columnInfo.DbColumnName,
                            Description     = columnInfo.ColumnDescription,
                            IsIdentity      = columnInfo.IsIdentity,
                            IsPrimaryKey    = columnInfo.IsPrimarykey,
                            Required        = columnInfo.IsNullable == false,
                            CodeTableId     = entity.Id,
                            CodeType        = typeInfo.CodeType.Name,
                            Length          = typeInfo.DbTypeInfo.Length,
                            DecimalDigits   = typeInfo.DbTypeInfo.DecimalDigits,
                            DefaultValue    = columnInfo.DefaultValue
                        };
                        code.ColumnInfoList.Add(column);
                    }
                    SaveCodeTableToDb(code);
                }
                ;
                systemDb.CommitTran();
                result.IsSuccess = true;
            }
            catch (Exception ex)
            {
                systemDb.RollbackTran();
                throw ex;
            }
            return(result);
        }
Example #15
0
        private static IDecoder GetDecoder(IFieldDecoder decoder)
        {
            BasePlugInFactory factory = BaseGlobalVariable.Current.FactoryManager.GetCodeFactory(
                CodeTablePlugInFactory.REG_NAME);
            CodeTable ct = factory.CreateInstance <CodeTable>(decoder.RegName);

            return(ct);
        }
Example #16
0
        public ActionResult DeleteConfirmed(int id)
        {
            CodeTable codeTable = db.CodeTables.Find(id);

            db.CodeTables.Remove(codeTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #17
0
        public override OutputData DoAction(IInputData input)
        {
            CodeTable table = PlugInFactoryManager.CreateInstance <CodeTable>(
                CodeTablePlugInFactory.REG_NAME, RegName);

            table.Fill(DataSet, Context);
            return(OutputData.Create(DataSet));
        }
Example #18
0
        //返回Table数据
        private CodeTable GetTable()
        {
            CodeTable ret = new CodeTable();

            ReadLeftBrace();
            while (PeekToken().Type != TokenType.RightBrace)
            {
                Token token = ReadToken();
                if (token.Type == TokenType.Identifier || token.Type == TokenType.String || token.Type == TokenType.SimpleString || token.Type == TokenType.Number ||
                    token.Type == TokenType.Boolean || token.Type == TokenType.Null)
                {
                    Token next = ReadToken();
                    if (next.Type == TokenType.Assign || next.Type == TokenType.Colon)
                    {
                        if (token.Type == TokenType.Null)
                        {
                            ret._Variables.Add(new CodeTable.TableVariable(m_script.Null.KeyValue, GetObject()));
                        }
                        else
                        {
                            ret._Variables.Add(new CodeTable.TableVariable(token.Lexeme, GetObject()));
                        }
                        Token peek = PeekToken();
                        if (peek.Type == TokenType.Comma || peek.Type == TokenType.SemiColon)
                        {
                            ReadToken();
                        }
                    }
                    else if (next.Type == TokenType.Comma || next.Type == TokenType.SemiColon)
                    {
                        if (token.Type == TokenType.Null)
                        {
                            ret._Variables.Add(new CodeTable.TableVariable(m_script.Null.KeyValue, new CodeScriptObject(m_script, null)));
                        }
                        else
                        {
                            ret._Variables.Add(new CodeTable.TableVariable(token.Lexeme, new CodeScriptObject(m_script, null)));
                        }
                    }
                    else
                    {
                        throw new ParserException("Table变量赋值符号为[=]或者[:]", token);
                    }
                }
                else if (token.Type == TokenType.Function)
                {
                    UndoToken();
                    ret._Functions.Add(ParseFunctionDeclaration(true));
                }
                else
                {
                    throw new ParserException("Table开始关键字必须为[变量名称]或者[function]关键字", token);
                }
            }
            ReadRightBrace();
            ret.Init();
            return(ret);
        }
Example #19
0
    private CodeTable <anon_689d51d359b141258928b1f3b4014cf2> From_f679e9125ac741039b19ae43171f05e5()
    {
        Call(15);
        IEnumerable <anon_689d51d359b141258928b1f3b4014cf2> join     = Fetch_bcab8e9d8d764da2a10772d49217ee68();
        CodeTable <anon_689d51d359b141258928b1f3b4014cf2>   newTable = new CodeTable <anon_689d51d359b141258928b1f3b4014cf2>();

        newTable.SetRows(join.ToList());
        return(newTable);
    }
        private CodeTable <CodeDataModel> GetCodeTableInstance(string regName)
        {
            CodeTable <CodeDataModel> rr = AtawIocContext.Current.FetchInstance <CodeTable <CodeDataModel> >(regName);

            //SetPostDataSet(ds);
            // rr.
            rr.Initialize(PostDataSet);
            return(rr);
        }
Example #21
0
    private CodeTable <anon_4ffac12ed6584b16899a543ed6d6662c> From_0b0a762c6e4644bdb952952b82e89af5()
    {
        Call(5);
        IEnumerable <anon_4ffac12ed6584b16899a543ed6d6662c> join     = Fetch_1f3e4ae495a54eaea2d5dd60e3bf8262();
        CodeTable <anon_4ffac12ed6584b16899a543ed6d6662c>   newTable = new CodeTable <anon_4ffac12ed6584b16899a543ed6d6662c>();

        newTable.SetRows(join.ToList());
        return(newTable);
    }
Example #22
0
    private CodeTable <anon_0bff662ab81749ce9629d644bb3a956d> From_47abbd03835942ada60a469ff108ccae()
    {
        Call(9);
        IEnumerable <anon_0bff662ab81749ce9629d644bb3a956d> join     = Fetch_77cba6599ad04f0a923c8b071955b7e5();
        CodeTable <anon_0bff662ab81749ce9629d644bb3a956d>   newTable = new CodeTable <anon_0bff662ab81749ce9629d644bb3a956d>();

        newTable.SetRows(join.ToList());
        return(newTable);
    }
Example #23
0
    private CodeTable <anon_e77da3131e1d4cf1970c18c99c04c921> From_063aa67f80e6401686b3f3c73c24dfc4()
    {
        Call(6);
        IEnumerable <anon_e77da3131e1d4cf1970c18c99c04c921> join     = Fetch_2c215013122d4959a2b1249ba18fc3a2();
        CodeTable <anon_e77da3131e1d4cf1970c18c99c04c921>   newTable = new CodeTable <anon_e77da3131e1d4cf1970c18c99c04c921>();

        newTable.SetRows(join.ToList());
        return(newTable);
    }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            CodeTable codeTable = await db.CodeTables.FindAsync(id);

            db.CodeTables.Remove(codeTable);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #25
0
        public ActionResult <ApiResult <string> > CreateTableByView([FromForm] string ViewSql, [FromForm] int dbid, [FromForm] string className)
        {
            ApiResult <string> result = new ApiResult <string>()
            {
                IsSuccess = true
            };
            var tableDb = base.GetTryDb(dbid);
            var dt      = tableDb.Ado.GetDataTable(ViewSql);

            base.Check(dt.Rows.Count == 0, "SQL查询必须要有一条记录才能创建类");
            CodeTable table = new CodeTable()
            {
                TableName   = className,
                CreateTime  = DateTime.Now,
                ClassName   = className,
                IsLock      = true,
                DbId        = dbid,
                UpdateTime  = DateTime.Now,
                Description = "数据源导入"
            };
            var id = Db.Insertable(table).ExecuteReturnIdentity();
            List <CodeColumns> cols = new List <CodeColumns>();
            var listtypes           = CodeTypeDb.GetList();

            foreach (System.Data.DataColumn item in dt.Columns)
            {
                CodeColumns columns = new CodeColumns()
                {
                    CodeTableId     = id,
                    ClassProperName = item.ColumnName,
                    DbColumnName    = item.ColumnName,
                    CodeType        = listtypes.FirstOrDefault(it => it.CSharepType.Equals(item.DataType.Name, StringComparison.OrdinalIgnoreCase) || it.DbType.Any(y => y.Name.Equals(item.DataType.Name, StringComparison.OrdinalIgnoreCase)))?.Name
                };
                if (item.DataType.Name.ToLower() == "int32")
                {
                    columns.CodeType = listtypes.Where(it => it.CSharepType == "int").First().Name;
                }
                if (item.DataType.Name.ToLower() == "int16")
                {
                    columns.CodeType = listtypes.Where(it => it.CSharepType == "short").First().Name;
                }
                if (item.DataType.Name.ToLower() == "int64")
                {
                    columns.CodeType = listtypes.Where(it => it.CSharepType == "long").First().Name;
                }
                if (string.IsNullOrEmpty(columns.CodeType))
                {
                    columns.CodeType = listtypes.Where(it => it.CSharepType == "string").First().Name;
                }
                cols.Add(columns);
            }
            Db.Insertable(cols).ExecuteReturnIdentity();
            result.IsSuccess = true;
            result.Data      = result.Message = "创建成功";
            return(result);
        }
        // GET: ChiTietCode
        public ActionResult ChiTietCode(int?maCode)
        {
            if (maCode == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadGateway));
            }
            CodeTable model = db.CodeTables.Find(maCode);

            return(View(model));
        }
Example #27
0
        //
        // GET: /CodeTable/Edit/5

        public ActionResult Edit(int id = 0)
        {
            CodeTable model = TimesheetRepository.GetCodeTableById(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
Example #28
0
        private static bool IsCached(CodeTable codeTable)
        {
            if (codeTable is ICacheDependencyCreator creator)
            {
                var cache = creator.CreateCacheDependency();
                return(cache == AlwaysDependency.Dependency);
            }

            return(false);
        }
Example #29
0
        public void Add(string regName, CodeTable codeTable)
        {
            TkDebug.AssertArgumentNullOrEmpty(regName, "regName", this);
            TkDebug.AssertArgumentNull(codeTable, "codeTable", this);

            if (!fData.ContainsKey(regName))
            {
                fData.Add(regName, new CodeTableContainer(codeTable));
            }
        }
Example #30
0
        private CodeTable GetTable()
        {
            CodeTable table = new CodeTable();

            this.ReadLeftBrace();
            while (this.PeekToken().Type != Scorpio.Compiler.TokenType.RightBrace)
            {
                Token token = this.ReadToken();
                if ((token.Type != Scorpio.Compiler.TokenType.Comma) && (token.Type != Scorpio.Compiler.TokenType.SemiColon))
                {
                    if ((((token.Type == Scorpio.Compiler.TokenType.Identifier) || (token.Type == Scorpio.Compiler.TokenType.String)) || ((token.Type == Scorpio.Compiler.TokenType.SimpleString) || (token.Type == Scorpio.Compiler.TokenType.Number))) || ((token.Type == Scorpio.Compiler.TokenType.Boolean) || (token.Type == Scorpio.Compiler.TokenType.Null)))
                    {
                        Token token2 = this.ReadToken();
                        if ((token2.Type == Scorpio.Compiler.TokenType.Assign) || (token2.Type == Scorpio.Compiler.TokenType.Colon))
                        {
                            if (token.Type == Scorpio.Compiler.TokenType.Null)
                            {
                                table._Variables.Add(new CodeTable.TableVariable(this.m_script.Null.KeyValue, this.GetObject()));
                            }
                            else
                            {
                                table._Variables.Add(new CodeTable.TableVariable(token.Lexeme, this.GetObject()));
                            }
                        }
                        else
                        {
                            if ((token2.Type != Scorpio.Compiler.TokenType.Comma) && (token2.Type != Scorpio.Compiler.TokenType.SemiColon))
                            {
                                throw new ParserException("Table变量赋值符号为[=]或者[:]", token);
                            }
                            if (token.Type == Scorpio.Compiler.TokenType.Null)
                            {
                                table._Variables.Add(new CodeTable.TableVariable(this.m_script.Null.KeyValue, new CodeScriptObject(this.m_script, null)));
                            }
                            else
                            {
                                table._Variables.Add(new CodeTable.TableVariable(token.Lexeme, new CodeScriptObject(this.m_script, null)));
                            }
                        }
                    }
                    else
                    {
                        if (token.Type != Scorpio.Compiler.TokenType.Function)
                        {
                            throw new ParserException("Table开始关键字必须为[变量名称]或者[function]关键字", token);
                        }
                        this.UndoToken();
                        table._Functions.Add(this.ParseFunctionDeclaration(true));
                    }
                }
            }
            this.ReadRightBrace();
            table.Init();
            return(table);
        }
Example #31
0
        public static string GetNextKey(string keyType)
        {
            using (ApplicationDbContext db = new ApplicationDbContext()) {
                CodeTable code = db.CodeTables.FirstOrDefault(s => s.Name == keyType);
                if (code == null)
                {
                    return(string.Empty);
                }
                string   prefix = code.Prefix;
                string   newKey = string.Empty;
                DateTime now    = DateTime.Now;
                int      year   = now.Year;
                int      month  = now.Month;
                int      day    = now.Day;
                int      keyVal = 1;
                KeyData  key;
                if (code.Continuous)
                {
                    key = db.KeyDatas.FirstOrDefault(t => t.KeyType == keyType);
                }
                else
                {
                    key = db.KeyDatas.SingleOrDefault(t => t.KeyType == keyType && t.KeyYear == year && t.KeyMonth == month && t.KeyDay == day);
                }
                if (key != null)
                {
                    keyVal              = key.KeyValue;
                    key.KeyValue       += 1;
                    db.Entry(key).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    key          = new KeyData();
                    key.KeyType  = keyType;
                    key.KeyYear  = year;
                    key.KeyMonth = month;
                    key.KeyDay   = day;
                    key.KeyValue = 2;
                    db.KeyDatas.Add(key);
                    db.SaveChanges();
                    keyVal = 1;
                }

                if (code.Continuous)
                {
                    newKey = prefix + keyVal.ToString("0000");
                }
                else
                {
                    newKey = prefix + (year % 100).ToString() + month.ToString("00") + day.ToString("00") + keyVal.ToString("0000");
                }
                return(newKey);
            }
        }
		// Constructor.
		JISConvert ()
		{
			// Load the conversion tables.
			using (var table = new CodeTable ("jis.table")) {
				Jisx0208ToUnicode = table.GetSection (JISX0208_To_Unicode);
				Jisx0212ToUnicode = table.GetSection (JISX0212_To_Unicode);
				CjkToJis = table.GetSection (CJK_To_JIS);
				GreekToJis = table.GetSection (Greek_To_JIS);
				ExtraToJis = table.GetSection (Extra_To_JIS);
			}
		}
Example #33
0
 private CodeTable<anon_e77da3131e1d4cf1970c18c99c04c921> Where_18735c6e301a42d68fee5c66fc258c09(CodeTable<anon_e77da3131e1d4cf1970c18c99c04c921> table)
 {
     Call(7);
     CodeTable<anon_e77da3131e1d4cf1970c18c99c04c921> newTable = new CodeTable<anon_e77da3131e1d4cf1970c18c99c04c921>();
     IList<anon_e77da3131e1d4cf1970c18c99c04c921> rows = table.Where(row =>
     {
         return true;
     }).ToList();
     newTable.SetRows(rows);
     IEnumerator<anon_e77da3131e1d4cf1970c18c99c04c921> i = newTable.GetEnumerator();
     for (
     ; i.MoveNext();
     )
     {
         anon_e77da3131e1d4cf1970c18c99c04c921 row = i.Current;
         row.DownloadPage = row.DownloadPage.CssWhere("ul.brandlist li");
     }
     return newTable;
 }
Example #34
0
 private CodeTable<anon_e77da3131e1d4cf1970c18c99c04c921> From_063aa67f80e6401686b3f3c73c24dfc4()
 {
     Call(6);
     IEnumerable<anon_e77da3131e1d4cf1970c18c99c04c921> join = Fetch_2c215013122d4959a2b1249ba18fc3a2();
     CodeTable<anon_e77da3131e1d4cf1970c18c99c04c921> newTable = new CodeTable<anon_e77da3131e1d4cf1970c18c99c04c921>();
     newTable.SetRows(join.ToList());
     return newTable;
 }
 public LzwDecompressStream(byte[] compressedBuffer, int minimumCodeLength)
 {
     _reader = new BitReader(compressedBuffer);
     _codeTable = new CodeTable(minimumCodeLength);
 }
        public int GetNewId(CodeTable tab)
        {
            int i = 0;

            using (var tx = new TransactionScope())
            {
                var get_id_db = getDB0;

                try
                {
                    string tab_name = Enum.GetName(typeof(ProcCore.Business.CodeTable), tab);
                    var item = get_id_db.i_IDX.Where(x => x.table_name == tab_name)
                        .ToList()
                        .FirstOrDefault();

                    if (item != null)
                    {
                        item.IDX++;
                        get_id_db.SaveChanges();
                        tx.Complete();
                        i = item.IDX;
                    }
                }
                catch (Exception ex)
                {
                    Log.Write(ex.ToString());
                }
                finally
                {
                    get_id_db.Dispose();
                }
                return i;
            }
        }