Example #1
0
        public Client()
        {
            _accounts = new List<Guid>();
            _bankCards = new EntityList<BankCard>(this);

            registerEvents();
        }
 public EntityBrokenBlock(PointF p, Object[] mpts, byte[,,] mp, EntityList par)
     : base(p, mpts, mp, par)
 {
     Velocity.X = DX.GetRand(4) - 2;
     Velocity.Y = -DX.GetRand(5) - 5;
     SetGraphic(DevelopUtility.GetRandom(18, 19, 50, 51));
 }
Example #3
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        if (!FileUpload1.HasFile) return;

        String xml = Encoding.UTF8.GetString(FileUpload1.FileBytes);

        try
        {
            //Menu m = Menu.FromXML(xml);
            //m.Import();
            EntityList<Menu> list = new EntityList<Menu>();
            list.FromXml(xml);

            if (list.Count > 0)
            {
                foreach (Menu item in list)
                {
                    item.Import();
                }
            }

            GridView1.DataBind();
        }
        catch (Exception ex)
        {
            WebHelper.Alert(ex.Message);

            XTrace.WriteLine(ex.ToString());
        }

    }
        public LinkResponsePersonModel(ChildWindow aChildWindow
                                      , ProductDomainContext aProductDomainContext
                                      , Dictionary<int, DepartmentEntity> aDepartmentEntityDictionary
                                      , Dictionary<String, UserEntity> aUserEntityDictionary)
        {
            ProductDomainContext = aProductDomainContext;
            childWidow = aChildWindow;
            DepartmentEntityDictionary = aDepartmentEntityDictionary;
            UserEntityDictionary = aUserEntityDictionary;

            ProjectEntityList = new ObservableCollection<ProjectEntity>();
            ProjectLinkEntityList = new ObservableCollection<ProjectEntity>();
            ProjectResponsibleEntityList = new ObservableCollection<ProjectResponsibleEntity>();
            ProjectResponsibleEntityALLList = new ObservableCollection<ProjectResponsibleEntity>();

            OnReflash = new DelegateCommand(OnReflashCommand);
            OnAddToProject = new DelegateCommand(OnAddToProjectCommand);
            OnRemoveProject = new DelegateCommand(OnRemoveProjectCommand);
            OnOk = new DelegateCommand(OnOkCommand);
            OnCancel = new DelegateCommand(OnCancelCommand);

            projectSource = new EntityList<ProductManager.Web.Model.project>(ProductDomainContext.projects);
            projectLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project>(
                LoadProjectEntities,
                LoadOperationProjectCompleted
                );
            projectView = new DomainCollectionView<ProductManager.Web.Model.project>(projectLoader, projectSource);

            projectResponsibSource = new EntityList<ProductManager.Web.Model.project_responsible>(ProductDomainContext.project_responsibles);
            projectResponsibLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project_responsible>(
                LoadProjectResponseEntities,
                LoadOperationProjectResponseCompleted
                );
            projectResponsibleView = new DomainCollectionView<ProductManager.Web.Model.project_responsible>(projectResponsibLoader, projectResponsibSource);
        }
 public DecisionTable()
 {
     Conditions = new EntityList<DTCondition>();
     Actions = new EntityList<DTAction>();
     Rules = new EntityList<DTRule>();
     SubTables = new EntityList<SubDecisionTable>();
 }
        /// <summary>
        /// Initializes a new instance of the CarsListViewModel class.
        /// </summary>
        public CarsListViewModel()
        {
            this._source = new EntityList<Car>(this._context.Cars);
            this._loader = new DomainCollectionViewLoader<Car>(
                                    this.LoadCars,
                                    this.OnLoadCarsCompleted);
            this._view = new DomainCollectionView<Car>(this._loader, this._source);

            #region DesignerProperties.IsInDesignTool
            // Swap out the loader for design-time scenarios
            if (IsInDesignMode)
            {
                DesignCarsLoader loader = new DesignCarsLoader();
                this._view = new DomainCollectionView<Car>(loader, loader.Source);
            }
            #endregion

            // Go back to the first page when the sorting changes
            INotifyCollectionChanged notifyingSortDescriptions =
                (INotifyCollectionChanged)this.CollectionView.SortDescriptions;
            notifyingSortDescriptions.CollectionChanged +=
                (sender, e) => this._view.MoveToFirstPage();

            this.Init();
            this.LoadView();

            //TO DO:Implement LoadNomenclatures method
            //this.LoadNomenclatures();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Admin loggedInAdmin = Helpers.GetLoggedInAdmin();

            if (!IsPostBack)
            {
                EntityList<Company> companies = new EntityList<Company>();
                if (!Helpers.IsSuperUser(loggedInAdmin))
                {
                    IEnumerable<Permission> permissions = Permission.GetPermissions().Where(p => p.admin_id == loggedInAdmin.admin_id);
                    foreach (Permission item in permissions)
                    {
                        companies.Add(item.company_);
                    }
                }
                else
                {
                    companies = Company.GetCompanies();
                }

                CompaniesGridView.DataSource = companies;
                CompaniesGridView.DataBind();
                if (companies.Count == 1)
                {
                    Session["company_id"] = companies[0].company_id;
                    Session["company_name"] = companies[0].name;
                    Response.Redirect("/manage/Dashboard.aspx");
                }
                PopuplateBreadcrumbs();
            }
        }
        public LinkFileViewModel(ChildWindow aChildWindow, Dictionary<int, FileTypeEntity> aFileTypeDictionary)
        {
            documentManagerContext = new Web.DocumentManagerDomainContext();
            childWindow = aChildWindow;
            SelectTaxPayerDocumentEntitis = new ObservableCollection<TaxPayerDocumentEntity>();
            TaxPayerEntityList = new ObservableCollection<TaxPayerEntity>();
            TaxPayerEntityLinkList = new ObservableCollection<TaxPayerEntity>();
            TaxPayerDocumentEntityList = new ObservableCollection<TaxPayerDocumentEntity>();
            FileTypeEntityDictionary = aFileTypeDictionary;
            GroupID = 1;
            OnOK = new DelegateCommand(OnOKCommand, CanOKCommand);
            OnCancel = new DelegateCommand(OnCancelCommand);
            OnReflash = new DelegateCommand(OnReflashCommand);
            OnAddToTaxPayer = new DelegateCommand(OnAddToTaxPayerCommand);
            OnRemoveTaxPayer = new DelegateCommand(OnRemoveTaxPayerCommand);

            taxPayerSource = new EntityList<DocumentManager.Web.Model.taxpayer>(documentManagerContext.taxpayers);
            taxPayerLoader = new DomainCollectionViewLoader<DocumentManager.Web.Model.taxpayer>(
                LoadTaxPayerEntities,
                LoadOperationTaxPayerCompleted
                );
            taxPayerView = new DomainCollectionView<DocumentManager.Web.Model.taxpayer>(taxPayerLoader, taxPayerSource);

            taxPayerDocumentSource = new EntityList<DocumentManager.Web.Model.taxpayerdocument>(documentManagerContext.taxpayerdocuments);
            taxPayerDocumentLoader = new DomainCollectionViewLoader<DocumentManager.Web.Model.taxpayerdocument>(
                LoadTaxPayerDocumentEntities,
                LoadOperationTaxPayerDocumentCompleted
                );
            taxPayerDocumentView = new DomainCollectionView<DocumentManager.Web.Model.taxpayerdocument>(taxPayerDocumentLoader, taxPayerDocumentSource);
        }
        public LinkFileViewModel( string aManufactureNumber, ObservableCollection<ProjectEntity> aProjectEntityList,
                    Dictionary<int, DepartmentEntity> aDepartmentDictionary,
                    Dictionary<int, UserEntity> aUserEntityDictionary,
                    Dictionary<int, FileTypeEntity> aFileTypeEntityDictionary)
        {
            ManufactureNumber = aManufactureNumber;

            ProjectEntityList = new ObservableCollection<ProjectEntity>();
            ProjectLinkEntityList = new ObservableCollection<ProjectEntity>();

            ProjectFilesEntityList = new ObservableCollection<ProjectFilesEntity>();
            ProductDomainContextForFile = new ProductDomainContext();
            DepartmentDictionary = aDepartmentDictionary;
            UserEntityDictionary = aUserEntityDictionary;
            FileTypeEntityDictionary = aFileTypeEntityDictionary;

            OnReflash = new DelegateCommand(OnReflashCommand);

            OnAddToProject = new DelegateCommand(OnAddToProjectCommand);
            OnRemoveProject = new DelegateCommand(OnRemoveProjectCommand);

            projectSource = new EntityList<ProductManager.Web.Model.project>(ProductDomainContextForFile.projects);
            projectLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project>(
                LoadProjectEntities,
                LoadOperationProjectCompleted
                );
            projectView = new DomainCollectionView<ProductManager.Web.Model.project>(projectLoader, projectSource);

            projectFileSource = new EntityList<ProductManager.Web.Model.project_files>(ProductDomainContextForFile.project_files);
            projectFileLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project_files>(
                LoadProjectFileEntities,
                loadOperationProjectFiles_Completed
                );
            projectFileView = new DomainCollectionView<ProductManager.Web.Model.project_files>(projectFileLoader, projectFileSource);
        }
 public void TestAddOne()
 {
     EntityList<EntityMock> list;
     list = new EntityList<EntityMock>();
     list.Add(new EntityMock());
     Assert.AreEqual(1, list.Count);            
 }
        /// <summary>
        /// Initializes a new instance of the PointsViewModelNew class.
        /// </summary>
        public MapViewModel()
        {
            source = new EntityList<Point>(context.Points);
            loader = new DomainCollectionViewLoader<Point>(LoadPoints, OnLoadPointsCompleted);
            view = new DomainCollectionView<Point>(loader, source);

            #region DesignerProperties.IsInDesignTool
            // Swap out the loader for design-time scenarios
            if (IsInDesignMode)
            {
                DesignPointsLoader designLoader = new DesignPointsLoader();
                this.view = new DomainCollectionView<Point>(designLoader, designLoader.Source);
            }
            #endregion

            //Move to first page when SortDescriptions is changed
            INotifyCollectionChanged notifySortDescriptions =
                (INotifyCollectionChanged)this.view.SortDescriptions;
            notifySortDescriptions.CollectionChanged +=
                (s, e) => view.MoveToFirstPage();

            using (this.View.DeferRefresh())
            {
                this.View.PageSize = 10;
                this.View.MoveToFirstPage();
            }

            this.RegisterMessages();
        }
        public DocumentManagerViewModel()
        {
            TaxPayerList = new ObservableCollection<TaxPayerEntity>();
            TaxPayerTypeList = new ObservableCollection<TaxPayerTypeEntity>();
            TaxPayerTypeEntityDictionary = new Dictionary<int, TaxPayerTypeEntity>();
            FileTypeList = new ObservableCollection<FileTypeEntity>();
            FileTypeDictionary = new Dictionary<int, FileTypeEntity>();
            UserEntityDictionary = new Dictionary<int, UserEntity>();

            DocumentViewModel = new DocumentViewModel();
            DocumentViewModel.BeginLoadings += BeginLoading;
            DocumentViewModel.FinishLoadings += FinishLoading;

            documentManagerContext = new DocumentManager.Web.DocumentManagerDomainContext();
            OnAddTaxPayer = new DelegateCommand(onAddTaxPayer);
            OnAddProject = new DelegateCommand(onAddProject, canAddProject);
            OnModifyTaxPayer = new DelegateCommand(onModifyTaxPayer, canModifyTaxPayer);
            OnDeleteTaxPayer = new DelegateCommand(onDeleteTaxPayer, canDeleteTacPayer);

            OnRefresh = new DelegateCommand(onRefresh);
            OnDoubleClickList = new DelegateCommand(onDoubleClickList);

            taxPayerDocumentSource = new EntityList<Web.Model.taxpayerdocument>(documentManagerContext.taxpayerdocuments);
            taxPayerDocumentLoader = new DomainCollectionViewLoader<Web.Model.taxpayerdocument>(
                LoadTaxPayerDocument,
                LoadTaxPayerDocument_Complete
                );
            taxPayerDocumentView = new DomainCollectionView<Web.Model.taxpayerdocument>(taxPayerDocumentLoader, taxPayerDocumentSource);
        }
 public EntityStrangeFlower(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
 {
     Location = pnt;
     Mpts = obj;
     Map = chips;
     Parent = par;
     Size = new Size(48, 48);
 }
Example #14
0
		public EntityItemSpawner(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
		{
			Location = pnt;
			Mpts = obj;
			Map = chips;
			Parent = par;
			Size = new Size(16, 16);
		}
 public EntityParticleBase(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
 {
     Location = pnt;
     Mpts = obj;
     Map = chips;
     Parent = par;
     Size = new Size(8, 8);
 }
        public void TestConvert()
        {
            EntityList list;
            list = new EntityList();
            list.Add(new EntityMock());

            IList<IEntity> converted = list;
        }
 public ProductEntity()
 {
     this.productPartTimeSource = new EntityList<ProductManager.Web.Model.product_part_time>(this.ProductDomainContext.product_part_times);
     this.productPartTimeLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.product_part_time>(
         this.LoadProductPartTime,
         this.LoadOperationProductPartTimeCompleted
         );
     this.productPartTimeView = new DomainCollectionView<ProductManager.Web.Model.product_part_time>(this.productPartTimeLoader, this.productPartTimeSource);
 }
Example #18
0
 public PathOfExile(Memory memory)
 {
     this.Memory = memory;
     this.Area = new AreaController(this);
     this.EntityList = new EntityList(this);
     this.Window = new GameWindow(memory.Process);
     this.Internal = new TheGame(memory);
     this.Files = new FileIndex(memory);
 }
        public DecisionTableManager()
        {
            DecisionTables = new EntityList<DecisionTable>();
            States = new EntityList<DTState>();

            EmptyState = EntityService.CreateNew<DTState>();
            NoPreferenceState = EntityService.CreateNew<DTState>();
            NoPreferenceState.Name = "-";
        }
 public EntityArrow(PointF pnt, Object[] obj, byte[,,] chps, EntityList par)
 {
     Mpts = obj;
     Map = chps;
     Parent = par;
     Location = pnt;
     SetGraphic(0);
     Velocity.X = -2;
 }
 public EntitySpider(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
 {
     Location = new PointF(pnt.X, pnt.Y + 64);
     Mpts = obj;
     Map = chips;
     Parent = par;
     Size = new Size(16, 16);
     CollisionAIs.Add(new AiKillDefender(this));
 }
 public EntityBunyo(PointF pnt, Object[] obj, byte[,,] chps, EntityList par)
 {
     Mpts = obj;
     Map = chps;
     Parent = par;
     Location = pnt;
     MainAi = new AiWalk(this, 1, 0, 1, 4, 5);
     CollisionAIs.Add(new AiKillDefender(this));
     Size = new Size(16, 16);
 }
 public EntityDensy(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
 {
     Location = pnt;
     Mpts = obj;
     Map = chips;
     Parent = par;
     Size = new Size(16, 16);
     MainAi = new AiFlySearch(this, 2, 0, 3, 0, 3);
     CollisionAIs.Add(new AiKillDefender(this));
 }
 public EntityModokee(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
 {
     Location = pnt;
     Mpts = obj;
     Map = chips;
     Parent = par;
     Size = new Size(32, 16);
     MainAi = new AiFlySine(this, 1, 0, 1, 4, 5);
     CollisionAIs.Add(new AiKillDefender(this));
 }
 public EntityArcher(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
 {
     Location = pnt;
     Mpts = obj;
     Map = chips;
     Parent = par;
     Size = new Size(32, 32);
     MainAi = new AiArch(this);
     CollisionAIs.Add(new AiKillDefender(this));
 }
 public EntityFighter(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
 {
     Location = pnt;
     Mpts = obj;
     Map = chips;
     Parent = par;
     Size = new Size(16, 32);
     CollisionAIs.Add(new AiKillDefender(this));
     SetAnime(0, 1, 8);
 }
 public EntityCameraMan(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
 {
     Location = pnt;
     Mpts = obj;
     Map = chips;
     Parent = par;
     Size = new Size(16, 32);
     CollisionAIs.Add(new AiKillDefender(this));
     Jump();
 }
        public EntityTurcos(PointF pnt, Object[] obj, byte[,,] chips, EntityList par)
        {
            Location = pnt;
            Mpts = obj;
            Map = chips;
            Parent = par;

            Size = new Size(24, 16);
            MainAi = new AiWalk(this, 1, 0, 1, 3, 4);
            CollisionAIs.Add(new AiKillDefender(this));
        }
        public void GetPointsList(Action<Microsoft.Windows.Data.DomainServices.EntityList<Point>> getPointsCallback, int pageSize)
        {
            EntitySet<Point> es = new EntitySet<Point>();
            DesignPoints designPoints = new DesignPoints();
            foreach (var dp in designPoints)
            {
                es.Add(dp);
            }

            var pointsEntityList = new EntityList<Point>(es);
            getPointsCallback(pointsEntityList);
        }
        public MenuSystem()
        {
            _background     = new EntityList(new List<Component> { new BeadGraphic(), new Window(), new MultiplePositions() });
            _buttons        = ButtonBuilder.ButtonList();
            _buildButtons   = ButtonBuilder.BuildButtonList();
            _inventory      = InventoryEntryBuilder.InventoryEntryList();

            EntityLists.Add(_background);
            EntityLists.Add(_buttons);
            EntityLists.Add(_buildButtons);
            EntityLists.Add(_inventory);
        }
 public async Task <EntityList> InstallSchemaAsync(IApiContext apiContext, EntityList entityList, EntityScope scope,
                                                   List <IndexedProperty> indexedProperties)
 {
     return(await InstallSchemaAsync(apiContext, entityList, scope, null, indexedProperties));
 }
Example #32
0
 private void GetFromBag(Item aItem, EntityList aToList)
 {
     fContainer.Contents.Extract(aItem);
     aToList.Add(aItem);
 }
Example #33
0
        public static void CheckForEntityInteractions(EntityList entityList)
        {
            //Check if player overlaps enemy
            foreach (var enemy in entityList.Enemies)
            {
                if (entityList.Player.XPosition == enemy.XPosition &&
                    entityList.Player.YPosition == enemy.YPosition &&
                    !HasSword)
                {
                    Score -= 100;
                    GameDisplay.DrawScore();
                    enemy.XPosition = 0;
                    enemy.YPosition = 0;
                }
                else if (entityList.Player.XPosition == enemy.XPosition &&
                         entityList.Player.YPosition == enemy.YPosition &&
                         HasSword)
                {
                    Score += 200;
                    GameDisplay.DrawScore();
                    enemy.XPosition = 0;
                    enemy.YPosition = 0;
                }
            }

            //Check if player overlaps coin
            foreach (var coin in entityList.Coins)
            {
                if (entityList.Player.XPosition == coin.XPosition &&
                    entityList.Player.YPosition == coin.YPosition)
                {
                    Score += 100;
                    GameDisplay.DrawScore();
                    coin.XPosition = 0;
                    coin.YPosition = 0;
                    GameDisplay.DrawMessage(coin);
                }
            }

            //Checks if player overlaps key
            if (entityList.Player.XPosition == entityList.Key.XPosition &&
                entityList.Player.YPosition == entityList.Key.YPosition)
            {
                HasKey = true;
                entityList.Key.XPosition = 0;
                entityList.Key.YPosition = 0;
                GameDisplay.DrawMessage(entityList.Key);
            }

            //Checks if player unlocks door
            if (entityList.Player.XPosition == entityList.Door.XPosition - 1 &&
                entityList.Player.YPosition == entityList.Door.YPosition && HasKey)
            {
                GameOver = true;
                GameDisplay.DrawWinScreen();
            }
            else if (entityList.Player.XPosition == entityList.Door.XPosition - 1 &&
                     entityList.Player.YPosition == entityList.Door.YPosition && !HasKey)
            {
                GameDisplay.DrawMessage(entityList.Door);
            }

            //Checks if player collects sword
            if (entityList.Player.XPosition == entityList.Sword.XPosition &&
                entityList.Player.YPosition == entityList.Sword.YPosition)
            {
                HasSword = true;
            }
        }
        /// <summary>
        /// 交易方法
        /// </summary>
        /// <param name="TranType">交易类型,1为消费,2消费确认,-2取消消费,5签到,6结算</param>
        /// <param name="htParams">交易参数,HIS流水号,病人ID,金额</param>
        /// <returns></returns>
        public override int Trans(string TranType, Hashtable htParams)
        {
            base.Trans(TranType, htParams);

            #region 消费
            if (TranType == "1")
            {
                #region 组织参数
                //POS机号使用自助机的编号
                string strInput = Check(htParams, "POSNO").Trim().PadRight(8, ' ').Substring(0, 8);

                //POS机操作员
                strInput += SysOperatorInfo.OperatorCode.Trim().PadRight(8, ' ');

                //交易类型
                strInput += "00";

                //获取交易金额,根据是12位的字符串,没有小数点到小数点后两位
                string strMoney = CheckMoney(htParams, "MONEY");
                strInput += strMoney;

                //原交易日期
                strInput += "".PadRight(8, ' ');

                //原交易参考号
                strInput += "".PadRight(12, ' ');

                //原凭证号
                strInput += "".PadRight(6, ' ');

                //LRC校验
                Random rm    = new Random();
                int    intrm = rm.Next(100, 999);
                strInput += intrm.ToString();

                string strDiagnoseID = Check(htParams, "DIAGNOSEID");
                string Seqno         = Check(htParams, "SEQNO");
                string CardID        = Check(htParams, "CARDID");

                #endregion

                #region 调用POS接口
                StringBuilder sbInput       = new StringBuilder(strInput);
                StringBuilder sbOutPut      = new StringBuilder(150);
                OutputData    theOutputData = null;

                try
                {
                    //调用银行交易
                    Pos_BankAll(sbInput, sbOutPut);

                    theOutputData = new OutputData(sbOutPut);
                }
                catch (Exception ex)
                {
                    LogService.GlobalInfoMessage("调用银行交易方法bankall失败:" + ex.Message);
                    throw ex;
                }
                #endregion

                #region 保存POS结算结果

                try
                {
                    DateTime ServerDate            = new CommonFacade().GetServerDateTime();
                    TBankhisexchangeTransData data = new TBankhisexchangeTransData();

                    //银行行号+批次号+授权号
                    data.Remark = theOutputData.BankCode + "|" + theOutputData.BatchNo + "|" + theOutputData.LicenseNo;

                    //银行卡号
                    data.ITEM1 = theOutputData.CardNo;

                    //凭证号
                    data.Bankseqno = theOutputData.VoucherNo;

                    //金额
                    data.Trfamt = theOutputData.TranMoney.ToString();

                    //商户号
                    data.Buscd = theOutputData.MchId;

                    //终端号
                    data.TerminalNo = theOutputData.TerminalNo;

                    //批次号
                    data.ITEM2 = theOutputData.BatchNo;

                    //交易日期
                    data.Operatetime = theOutputData.YHJYSJ;
                    data.Operatorid  = SysOperatorInfo.OperatorID;

                    //交易参考号
                    data.Ohisseqno = theOutputData.RefNo;

                    data.Usetype    = "充值";
                    data.Hisid      = CardID;
                    data.DIAGNOSEID = strDiagnoseID;
                    data.Hisseqno   = Seqno;

                    data.DataSources  = "自助";
                    data.BusinessType = "POS充值";
                    data.Bankstate    = "0";
                    data.Hisstate     = "0";

                    TBankhisexchangeTransFacade facade = new TBankhisexchangeTransFacade();
                    facade.Insert(data);
                    LogService.GlobalInfoMessage("调用银行支付交易成功,写入数据库成功!");
                    htParams.Add("CARDNO", theOutputData.CardNo);
                    htParams.Add("BANKSEQNO", theOutputData.RefNo + "|" + theOutputData.VoucherNo);
                }
                catch (Exception ex)
                {
                    LogService.GlobalInfoMessage("保存POS直联记录表T_BANKHISEXCHANGE_TRANS失败:" + ex.Message);
                    DeleteBankTran(htParams, theOutputData.VoucherNo);
                    throw ex;
                }
                #endregion
            }

            #endregion

            #region 消费确认
            if (TranType == "2")
            {
                //更新交易中间层的记录标识T_BANKHISEXCHANGE_RECORD
                TBankhisexchangeTransFacade facade = new TBankhisexchangeTransFacade();
                string Seqno = Check(htParams, "SEQNO");
                facade.UpdateState(Seqno, "HISSTATE", "1");
            }
            #endregion

            #region 消费撤消
            if (TranType == "-2")
            {
                //根据交易流水号查询HIS中已经存在的交易记录
                string Seqno         = Check(htParams, "SEQNO");
                string strDiagnoseID = Check(htParams, "DIAGNOSEID");
                string CardID        = Check(htParams, "CARDID");

                TBankhisexchangeTransFacade            facade = new TBankhisexchangeTransFacade();
                EntityList <TBankhisexchangeTransData> list   = facade.Get("HISSEQNO = '" + Seqno + "'");
                if (list.Count > 0)
                {
                    #region 如果已经存在,则调用撤消方法

                    #region 组织相关参数
                    LogService.GlobalInfoMessage("HIS处理失败,请用银行的撤消交易开始!");
                    //POS机号使用自助机的编号
                    string strInput = Check(htParams, "POSNO").Trim().PadRight(8, ' ').Substring(0, 8);

                    //POS机操作员
                    strInput += SysOperatorInfo.OperatorCode.Trim().PadRight(8, ' ');

                    //交易类型
                    strInput += "01";

                    //获取交易金额,根据是12位的字符串,没有小数点到小数点后两位
                    string strMoney = CheckMoney(htParams, "MONEY");
                    strInput += strMoney;

                    //原交易日期
                    strInput += "".PadRight(8, ' ');

                    //原交易参考号
                    strInput += "".PadRight(12, ' ');

                    //原凭证号
                    strInput += list[0].Bankseqno;

                    //LRC校验
                    Random rm    = new Random();
                    int    intrm = rm.Next(100, 999);
                    strInput += intrm.ToString();

                    #endregion

                    #region 调用POS接口
                    StringBuilder sbInput       = new StringBuilder(strInput);
                    StringBuilder sbOutPut      = new StringBuilder(150);
                    OutputData    theOutputData = null;

                    try
                    {
                        //调用银行交易
                        Pos_BankAll(sbInput, sbOutPut);

                        theOutputData = new OutputData(sbOutPut);
                    }
                    catch (Exception ex)
                    {
                        LogService.GlobalInfoMessage("调用银行交易方法bankall失败:" + ex.Message);
                        throw ex;
                    }
                    #endregion

                    #region 保存POS结算结果
                    try
                    {
                        facade.UpdateState(Seqno, "HISSTATE", "-1");

                        DateTime ServerDate            = new CommonFacade().GetServerDateTime();
                        TBankhisexchangeTransData data = new TBankhisexchangeTransData();

                        //银行行号+批次号+授权号
                        data.Remark = theOutputData.BankCode + "|" + theOutputData.BatchNo + "|" + theOutputData.LicenseNo;

                        //银行卡号
                        data.ITEM1 = theOutputData.CardNo;

                        //凭证号
                        data.Bankseqno = theOutputData.VoucherNo;

                        //金额
                        data.Trfamt = (theOutputData.TranMoney * -1).ToString();

                        //商户号
                        data.Buscd = theOutputData.MchId;

                        //终端号
                        data.TerminalNo = theOutputData.TerminalNo;

                        //批次号
                        data.ITEM2 = theOutputData.BatchNo;

                        //交易日期
                        data.Operatetime = theOutputData.YHJYSJ;
                        data.Operatorid  = SysOperatorInfo.OperatorID;

                        //交易参考号
                        data.Ohisseqno = theOutputData.RefNo;

                        data.Usetype    = "冲正";
                        data.Hisid      = CardID;
                        data.DIAGNOSEID = strDiagnoseID;

                        data.Hisseqno = Seqno + "R";

                        data.DataSources  = "自助";
                        data.BusinessType = "POS充值";
                        data.Bankstate    = "0";
                        data.Hisstate     = "-2";

                        facade.Insert(data);
                        LogService.GlobalInfoMessage("调用银行支付交易成功,写入数据库成功!");
                    }
                    catch (Exception ex)
                    {
                        LogService.GlobalInfoMessage("保存POS直联记录表T_BANKHISEXCHANGE_TRANS失败:" + ex.Message);
                        throw ex;
                    }
                    #endregion

                    #endregion
                }
                else
                {
                    LogService.GlobalInfoMessage("HIS结算失败,调用银行冲正查询数据未找到,条件:" + "HISSEQNO = '" + Seqno + "'");
                }
            }
            #endregion

            #region 签到
            if (TranType == "5")
            {
                string PosNo = Check(htParams, "POSNO").Trim();
                //判断当天是否已经进行签到,如果签到不再进行签到
                DateTime ServerDate = new CommonFacade().GetServerDateTime();
                string   Currdate   = ServerDate.ToString("yyyyMMdd");
                HealthCardAuthkeyFacade theAuthKeyfacade = new HealthCardAuthkeyFacade();
                HealthCardAuthkeyData   theEntitydata    = theAuthKeyfacade.GetByPrimaryKey(PosNo, Currdate);
                if (theEntitydata != null)
                {
                    return(0);
                }
                try
                {
                    Trans("6", htParams);
                }
                catch (Exception ex)
                {
                    LogService.GlobalInfoMessage("调用 POS结算业务失败:" + ex.Message);
                }
                #region 组织参数
                //POS机号使用自助机的编号
                string strInput = Check(htParams, "POSNO").Trim().PadRight(8, ' ').Substring(0, 8);

                //POS机操作员
                strInput += SysOperatorInfo.OperatorCode.Trim().PadRight(8, ' ');

                //交易类型
                strInput += "05";

                //获取交易金额
                strInput += "000000000000";

                //原交易日期
                strInput += "".PadRight(8, ' ');

                //原交易参考号
                strInput += "".PadRight(12, ' ');

                //原凭证号
                strInput += "".PadRight(6, ' ');

                //LRC校验
                Random rm    = new Random();
                int    intrm = rm.Next(100, 999);
                strInput += intrm.ToString();

                #endregion

                #region 调用POS接口
                StringBuilder sbInput       = new StringBuilder(strInput);
                StringBuilder sbOutPut      = new StringBuilder(150);
                OutputData    theOutputData = null;

                try
                {
                    //调用银行交易
                    Pos_BankAll(sbInput, sbOutPut);

                    theOutputData = new OutputData(sbOutPut);

                    theEntitydata          = new HealthCardAuthkeyData();
                    theEntitydata.Orgcode  = PosNo;
                    theEntitydata.Username = Currdate;
                    theEntitydata.Authkey  = theOutputData.MchId + "|" + theOutputData.TranTime;
                    theAuthKeyfacade.Insert(theEntitydata);

                    LogService.GlobalInfoMessage("调用银行交易方法bankall签到交易成功!");
                }
                catch (Exception ex)
                {
                    LogService.GlobalInfoMessage("调用银行交易方法bankall签到失败:" + ex.Message);
                    throw ex;
                }
                #endregion
            }
            #endregion

            #region 结算
            if (TranType == "6")
            {
                #region 组织参数
                //POS机号使用自助机的编号
                string strInput = Check(htParams, "POSNO").Trim().PadRight(8, ' ').Substring(0, 8);

                //POS机操作员
                strInput += SysOperatorInfo.OperatorCode.Trim().PadRight(8, ' ');

                //交易类型
                strInput += "06";

                //获取交易金额
                strInput += "000000000000";

                //原交易日期
                strInput += "".PadRight(8, ' ');

                //原交易参考号
                strInput += "".PadRight(12, ' ');

                //原凭证号
                strInput += "".PadRight(6, ' ');

                //LRC校验
                Random rm    = new Random();
                int    intrm = rm.Next(100, 999);
                strInput += intrm.ToString();

                #endregion

                #region 调用POS接口
                StringBuilder sbInput       = new StringBuilder(strInput);
                StringBuilder sbOutPut      = new StringBuilder(150);
                OutputData    theOutputData = null;

                try
                {
                    //调用银行交易
                    Pos_BankAll(sbInput, sbOutPut);

                    theOutputData = new OutputData(sbOutPut);
                    LogService.GlobalInfoMessage("调用银行交易方法bankall结算交易成功!");
                }
                catch (Exception ex)
                {
                    LogService.GlobalInfoMessage("调用银行交易方法bankall结算失败:" + ex.Message);
                    throw ex;
                }
                #endregion
            }
            #endregion

            return(0);
        }
Example #35
0
        internal EntityList QueryList(Action <IPropertyQuery> queryBuider, Predicate <Entity> filter = null, EntityList entityList = null)
        {
            var query = this.CreatePropertyQuery();

            if (queryBuider != null)
            {
                queryBuider(query);
            }
            return(this.QueryList(new PropertyQueryArgs
            {
                PropertyQuery = query,
                Filter = filter,
                EntityList = entityList
            }));
        }
        public void BulkInsert(string compId, DbTransaction transaction, object entities)
        {
            EntityList <PartnerItemXref> list = entities as EntityList <PartnerItemXref>;

            if (list == null)
            {
                throw new InvalidValueException("Unable to cast entity list object");
            }

            System.Data.SqlClient.SqlBulkCopy bulkCopy = null;

            if (transaction != null)
            {
                System.Data.SqlClient.SqlConnection  cnx            = transaction.Connection as System.Data.SqlClient.SqlConnection;
                System.Data.SqlClient.SqlTransaction sqltransaction = transaction as System.Data.SqlClient.SqlTransaction;
                bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, sqltransaction); //, null);
            }
            else
            {
                bulkCopy = new System.Data.SqlClient.SqlBulkCopy(
                    ConnectionSetting.GetSqlConnection(Core.ApplicationContext.DataConnectionString, compId).ConnectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
            }

            bulkCopy.BulkCopyTimeout      = 360;
            bulkCopy.DestinationTableName = "tblEdPartnerItemXref";

            DataTable  dataTable = new DataTable();
            DataColumn col0      = dataTable.Columns.Add("PartnerId", typeof(System.String));

            col0.AllowDBNull = false;
            DataColumn col1 = dataTable.Columns.Add("TravItemId", typeof(System.String));

            col1.AllowDBNull = false;
            DataColumn col2 = dataTable.Columns.Add("TravUom", typeof(System.String));

            col2.AllowDBNull = false;
            DataColumn col3 = dataTable.Columns.Add("EdiUom", typeof(System.String));

            col3.AllowDBNull = false;
            DataColumn col4 = dataTable.Columns.Add("EAN", typeof(System.String));

            col4.AllowDBNull = true;
            DataColumn col5 = dataTable.Columns.Add("GTIN", typeof(System.String));

            col5.AllowDBNull = true;
            DataColumn col6 = dataTable.Columns.Add("UPC", typeof(System.String));

            col6.AllowDBNull = true;
            DataColumn col7 = dataTable.Columns.Add("SKU", typeof(System.String));

            col7.AllowDBNull = true;
            DataColumn col8 = dataTable.Columns.Add("BuyerCode", typeof(System.String));

            col8.AllowDBNull = true;
            DataColumn col9 = dataTable.Columns.Add("VendorCode", typeof(System.String));

            col9.AllowDBNull = true;
            DataColumn col10 = dataTable.Columns.Add("InternalCode", typeof(System.String));

            col10.AllowDBNull = true;
            DataColumn col11 = dataTable.Columns.Add("InternalCode1", typeof(System.String));

            col11.AllowDBNull = true;
            DataColumn col12 = dataTable.Columns.Add("InternalCode2", typeof(System.String));

            col12.AllowDBNull = true;

            bulkCopy.ColumnMappings.Add("PartnerId", "PartnerId");
            bulkCopy.ColumnMappings.Add("TravItemId", "TravItemId");
            bulkCopy.ColumnMappings.Add("TravUom", "TravUom");
            bulkCopy.ColumnMappings.Add("EdiUom", "EdiUom");
            bulkCopy.ColumnMappings.Add("EAN", "EAN");
            bulkCopy.ColumnMappings.Add("GTIN", "GTIN");
            bulkCopy.ColumnMappings.Add("UPC", "UPC");
            bulkCopy.ColumnMappings.Add("SKU", "SKU");
            bulkCopy.ColumnMappings.Add("BuyerCode", "BuyerCode");
            bulkCopy.ColumnMappings.Add("VendorCode", "VendorCode");
            bulkCopy.ColumnMappings.Add("InternalCode", "InternalCode");
            bulkCopy.ColumnMappings.Add("InternalCode1", "InternalCode1");
            bulkCopy.ColumnMappings.Add("InternalCode2", "InternalCode2");

            foreach (PartnerItemXref entity in list)
            {
                if (entity.EntityState != EntityState.Added)
                {
                    continue;
                }
                DataRow row = dataTable.NewRow();
                row["PartnerId"]     = entity.PartnerId;
                row["TravItemId"]    = entity.TravItemId;
                row["TravUom"]       = entity.TravUom;
                row["EdiUom"]        = entity.EdiUom;
                row["EAN"]           = entity.EAN;
                row["GTIN"]          = entity.GTIN;
                row["UPC"]           = entity.UPC;
                row["SKU"]           = entity.SKU;
                row["BuyerCode"]     = entity.BuyerCode;
                row["VendorCode"]    = entity.VendorCode;
                row["InternalCode"]  = entity.InternalCode;
                row["InternalCode1"] = entity.InternalCode1;
                row["InternalCode2"] = entity.InternalCode2;

                dataTable.Rows.Add(row);
            }

            // send the data to the server
            bulkCopy.WriteToServer(dataTable);
            // update back the state
            foreach (PartnerItemXref entity in list)
            {
                if (entity.EntityState != EntityState.Added)
                {
                    continue;
                }
                entity.AcceptChanges();
            }
        }
Example #37
0
 public async Task <IActionResult> GetTableName()
 {
     try
     {
         List <DropDown> lstDropDown = new List <DropDown>();
         lstDropDown.Add(new DropDown
         {
             Value = 1,
             Text  = "N/A"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 2,
             Text  = "Mort_Base_Acc_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 3,
             Text  = "Mort_Base_Acc_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 4,
             Text  = "Mort_Base_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 5,
             Text  = "Mort_Impro_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 6,
             Text  = "AIDS_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 7,
             Text  = "Disab_Temp_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 8,
             Text  = "Disab_Perm_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "Retr_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "Crit_Ill_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "Mat_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "Lapse_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "Full_Paid_UP_Table"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "Semi_Paid_UP_Table"
         });
         var result = new EntityList <DropDown>
         {
             Total    = lstDropDown.Count(),
             Entities = lstDropDown,
         };
         return(this.Ok(result));
     }
     catch (Exception ex)
     {
         return(this.BadRequest(ex.Message));
     }
 }
Example #38
0
 public abstract void Update(EntityList entities, List <int> controls);
Example #39
0
        public async Task <bool> createManifest(EntityList entityList, bool resolveRef = true, bool createModelJson = false)
        {
            bool   manifestCreated = false;
            string manifestName    = entityList.manifestName;

            Console.WriteLine("Make placeholder manifest");
            // Add the temp manifest to the root of the local adapter in the corpus
            var localRoot = cdmCorpus.Storage.FetchRootFolder("adls");

            CdmManifestDefinition manifestAbstract = cdmCorpus.MakeObject <CdmManifestDefinition>(CdmObjectType.ManifestDef, "tempAbstract");

            localRoot.Documents.Add(manifestAbstract, "TempAbstract.manifest.cdm.json");

            // Create two entities from scratch, and add some attributes, traits, properties, and relationships in between
            Console.WriteLine("Create net new entities");

            List <EntityDefinition> EntityDefinitions = entityList.entityDefinitions;

            foreach (EntityDefinition entityDefinition in EntityDefinitions)
            {
                string entityName       = entityDefinition.name;
                string entityDesciption = entityDefinition.description;
                // Create the entity definition instance
                var entity = cdmCorpus.MakeObject <CdmEntityDefinition>(CdmObjectType.EntityDef, entityName, false);
                // Add properties to the entity instance
                entity.DisplayName = entityName;
                entity.Version     = "1.0.0";
                entity.Description = entityDesciption;

                List <dynamic> attributes = entityDefinition.attributes;

                foreach (var a in attributes)
                {
                    // Add type attributes to the entity instance
                    entity.Attributes.Add(sqlToCDMAttribute(cdmCorpus, a));
                }

                // Create the document which contains the entity
                var entityDoc = cdmCorpus.MakeObject <CdmDocumentDefinition>(CdmObjectType.DocumentDef, $"{entityName}.cdm.json", false);
                // Add an import to the foundations doc so the traits about partitons will resolve nicely
                entityDoc.Imports.Add(FoundationJsonPath);
                entityDoc.Definitions.Add(entity);
                // Add the document to the root of the local documents in the corpus
                var document = localRoot.Documents.Add(entityDoc, entityDoc.Name);
                if (resolveRef == false)
                {
                    await document.SaveAsAsync($"{entityName}.cdm.json");
                }

                manifestAbstract.Entities.Add(entity);
            }

            CdmManifestDefinition manifestResolved;

            manifestResolved = await manifestAbstract.CreateResolvedManifestAsync(manifestName, null);

            // Add an import to the foundations doc so the traits about partitons will resolve nicely
            manifestResolved.Imports.Add(FoundationJsonPath);

            foreach (CdmEntityDeclarationDefinition eDef in manifestResolved.Entities)
            {
                // Get the entity being pointed at
                var localEDef = eDef;
                var entDef    = await cdmCorpus.FetchObjectAsync <CdmEntityDefinition>(localEDef.EntityPath, manifestResolved);

                var entityDefinition = EntityDefinitions.Find(x => x.name.Equals(entDef.EntityName, StringComparison.OrdinalIgnoreCase));

                if (entityDefinition != null)
                {
                    var part = cdmCorpus.MakeObject <CdmDataPartitionDefinition>(CdmObjectType.DataPartitionDef, $"{entDef.EntityName}-data");
                    eDef.DataPartitions.Add(part);
                    part.Explanation = "data files";

                    // We have existing partition files for the custom entities, so we need to make the partition point to the file location
                    part.Location = $"adls:{entityDefinition.dataPartitionLocation}/{entityDefinition.partitionPattern}";

                    if (entityDefinition.partitionPattern.Contains("parquet"))
                    {
                        part.ExhibitsTraits.Add("is.partition.format.parquet", false);
                    }
                    //default is csv
                    else
                    {
                        // Add trait to partition for csv params
                        var csvTrait = part.ExhibitsTraits.Add("is.partition.format.CSV", false);
                        csvTrait.Arguments.Add("columnHeaders", "false");
                        csvTrait.Arguments.Add("delimiter", ",");
                    }
                }
            }
            Console.WriteLine("Save the documents");
            // We can save the documents as manifest.cdm.json format or model.json
            // Save as manifest.cdm.json

            manifestCreated = await manifestResolved.SaveAsAsync($"{manifestName}.manifest.cdm.json", resolveRef);

            // Save as a model.json
            if (createModelJson)
            {
                await manifestResolved.SaveAsAsync("model.json", true);
            }
            return(manifestCreated);
        }
Example #40
0
 /// <summary>
 /// 使用仓库保存指定的列表。
 ///
 /// 默认使用逐条备份的方式。
 /// 子类可以重写此方法来实现批量数据的导入。
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="entityList"></param>
 protected virtual void SaveList(IRepository repository, EntityList entityList)
 {
     repository.Save(entityList);
 }
Example #41
0
        /// <summary>
        /// 从原始表中移除聚合。
        /// </summary>
        /// <param name="repository">表示当前 <see cref="EntityList" /> 对应的仓库。</param>
        /// <param name="entityList">表示一个领域对象的集合。</param>
        private void DeleteOriginalData(IRepository repository, EntityList entityList)
        {
            entityList.Clear();

            this.SaveList(repository, entityList);
        }
Example #42
0
        /// <summary>
        /// 进行搜索
        /// </summary>
        public virtual void DoSearch()
        {
            var cmd = GetSearchCommand();

            if (cmd == null)
            {
                IOrderedQueryable <TModel> query = null;
                //根据搜索模式调用不同的函数
                switch (SearcherMode)
                {
                case ListVMSearchModeEnum.Search:
                    query = GetSearchQuery();
                    break;

                case ListVMSearchModeEnum.Export:
                    query = GetExportQuery();
                    break;

                case ListVMSearchModeEnum.Batch:
                    query = GetBatchQuery();
                    break;

                case ListVMSearchModeEnum.MasterDetail:
                    query = GetMasterDetailsQuery();
                    break;

                case ListVMSearchModeEnum.CheckExport:
                    query = GetCheckedExportQuery();
                    break;

                case ListVMSearchModeEnum.Selector:
                    query = GetSelectorQuery();
                    break;

                default:
                    query = GetSearchQuery();
                    break;
                }

                //如果设定了替换条件,则使用替换条件替换Query中的Where语句
                if (ReplaceWhere != null)
                {
                    var mod    = new WhereReplaceModifier <TopBasePoco>(ReplaceWhere);
                    var newExp = mod.Modify(query.Expression);
                    query = query.Provider.CreateQuery <TModel>(newExp) as IOrderedQueryable <TModel>;
                }
                if (Searcher.SortInfo != null)
                {
                    var mod    = new OrderReplaceModifier(Searcher.SortInfo);
                    var newExp = mod.Modify(query.Expression);
                    query = query.Provider.CreateQuery <TModel>(newExp) as IOrderedQueryable <TModel>;
                }
                if (typeof(TModel).IsSubclassOf(typeof(PersistPoco)))
                {
                    var mod    = new IsValidModifier();
                    var newExp = mod.Modify(query.Expression);
                    query = query.Provider.CreateQuery <TModel>(newExp) as IOrderedQueryable <TModel>;
                }
                if (PassSearch == false)
                {
                    //如果需要分页,则添加分页语句
                    if (NeedPage && Searcher.Limit != -1)
                    {
                        //获取返回数据的数量
                        var count = query.Count();
                        if (count < 0)
                        {
                            count = 0;
                        }
                        if (Searcher.Limit == 0)
                        {
                            Searcher.Limit = ConfigInfo?.UiOptions.DataTable.RPP ?? 20;
                        }
                        //根据返回数据的数量,以及预先设定的每页行数来设定数据量和总页数
                        Searcher.Count     = count;
                        Searcher.PageCount = (int)Math.Ceiling((1.0 * Searcher.Count / Searcher.Limit));
                        if (Searcher.Page <= 0)
                        {
                            Searcher.Page = 1;
                        }
                        if (Searcher.PageCount > 0 && Searcher.Page > Searcher.PageCount)
                        {
                            Searcher.Page = Searcher.PageCount;
                        }
                        EntityList = query.Skip((Searcher.Page - 1) * Searcher.Limit).Take(Searcher.Limit).AsNoTracking().ToList();
                    }
                    else //如果不需要分页则直接获取数据
                    {
                        EntityList         = query.AsNoTracking().ToList();
                        Searcher.Count     = EntityList.Count();
                        Searcher.Limit     = EntityList.Count();
                        Searcher.PageCount = 1;
                        Searcher.Page      = 1;
                    }
                }
                else
                {
                    EntityList = query.AsNoTracking().ToList();
                }
            }
            else
            {
                ProcessCommand(cmd);
            }
            IsSearched = true;
            //调用AfterDoSearch函数来处理自定义的后续操作
            AfterDoSearcher();
        }
Example #43
0
 /// <summary>
 /// Gets an entity at index.
 /// </summary>
 /// <typeparam name="t">The type of the list entries.</typeparam>
 /// <param name="list">The list to be queried.</param>
 /// <param name="id">The <see cref="IItem"/> identifier.</param>
 /// <returns>An instance of the <typeparamref name="t"/> for the selected index.</returns>
 public static t GetAtIndex <t>(this EntityList <t> list, int id)
     where t : class, IItem
 {
     return((from idx in list where idx.Id == id select idx).First());
 }
Example #44
0
        /// <summary>Retorna a lista de objetos aplicando um filtro</summary>
        /// <param name="filter">Expressão a ser usada como filtro</param>
        /// <returns>Lista de objetos encontrados</returns>
        public static List <T> Select <T, TKey>(T entity, Expression <Func <T, Boolean> > filter, EntityList <T> loadRelatedEntities, Expression <Func <T, TKey> > ordenacao, Int32 page = -1, Int32 pageSize = -1, Boolean asc = true) where T : Entity, new()
        {
            //Busca o objeto solicitado
            using (DataBaseContext db = GetDatabaseContext())
            {
                IQueryable <T> query = null;

                if (filter == null)
                {
                    query = db.Set <T>().AsQueryable();
                }
                else
                {
                    query = db.Set <T>().Where(filter);
                }

                //Carrega as entidades solicitadas
                if (loadRelatedEntities != null && loadRelatedEntities.List != null && loadRelatedEntities.List.Any())
                {
                    foreach (var path in loadRelatedEntities.List)
                    {
                        query = query.Include(path);
                    }
                }

                //Ordena os itens
                if (ordenacao != null)
                {
                    if (!asc)
                    {
                        query = query.OrderByDescending(ordenacao);
                    }
                    else
                    {
                        query = query.OrderBy(ordenacao);
                    }
                }

                //Efetua a busca no banco
                if (page > -1 && pageSize > -1)
                {
                    query = query.Skip(page * pageSize).Take(pageSize);
                }

                //Retorna
                return(query.Where(x => !x.Deleted).AsNoTracking().ToList());
            }
        }
Example #45
0
        public virtual void UpdateEntityList(bool updateAllFields = false)
        {
            if (EntityList != null)
            {
                var            ftype    = EntityList.GetType().GenericTypeArguments.First();
                PropertyInfo[] itemPros = ftype.GetProperties();

                foreach (var newitem in EntityList)
                {
                    var subtype = newitem.GetType();
                    if (subtype.IsSubclassOf(typeof(BasePoco)))
                    {
                        BasePoco ent = newitem as BasePoco;
                        if (ent.UpdateTime == null)
                        {
                            ent.UpdateTime = DateTime.Now;
                        }
                        if (string.IsNullOrEmpty(ent.UpdateBy))
                        {
                            ent.UpdateBy = LoginUserInfo?.ITCode;
                        }
                    }
                    //循环页面传过来的子表数据,将关联到TopBasePoco的字段设为null,并且把外键字段的值设定为主表ID
                    foreach (var itempro in itemPros)
                    {
                        if (itempro.PropertyType.IsSubclassOf(typeof(TopBasePoco)))
                        {
                            itempro.SetValue(newitem, null);
                        }
                    }
                }

                IEnumerable <TopBasePoco> data = null;
                //打开新的数据库联接,获取数据库中的主表和子表数据
                using (var ndc = DC.CreateNew())
                {
                    var ids = EntityList.Select(x => x.GetID().ToString()).ToList();
                    data = ndc.Set <TModel>().AsNoTracking().Where(ids.GetContainIdExpression <TModel>()).ToList();
                }
                //比较子表原数据和新数据的区别
                IEnumerable <TopBasePoco> toadd    = null;
                IEnumerable <TopBasePoco> toremove = null;
                Utils.CheckDifference(data, EntityList, out toremove, out toadd);
                //设定子表应该更新的字段
                List <string> setnames = new List <string>();
                foreach (var field in FC.Keys)
                {
                    if (field.StartsWith("EntityList[0]."))
                    {
                        string name = field.Replace("EntityList[0].", "");
                        setnames.Add(name);
                    }
                }

                //前台传过来的数据
                foreach (var newitem in EntityList)
                {
                    //数据库中的数据
                    foreach (var item in data)
                    {
                        //需要更新的数据
                        if (newitem.GetID().ToString() == item.GetID().ToString())
                        {
                            dynamic i           = newitem;
                            var     newitemType = item.GetType();
                            foreach (var itempro in itemPros)
                            {
                                if (!itempro.PropertyType.IsSubclassOf(typeof(TopBasePoco)) && (updateAllFields == true || setnames.Contains(itempro.Name)))
                                {
                                    var notmapped = itempro.GetCustomAttribute <NotMappedAttribute>();
                                    if (itempro.Name != "ID" && notmapped == null && itempro.PropertyType.IsList() == false)
                                    {
                                        DC.UpdateProperty(i, itempro.Name);
                                    }
                                }
                            }
                            if (item.GetType().IsSubclassOf(typeof(BasePoco)))
                            {
                                DC.UpdateProperty(i, "UpdateTime");
                                DC.UpdateProperty(i, "UpdateBy");
                            }
                        }
                    }
                }
                //需要删除的数据
                foreach (var item in toremove)
                {
                    //如果是PersistPoco,则把IsValid设为false,并不进行物理删除
                    if (ftype.IsSubclassOf(typeof(PersistPoco)))
                    {
                        (item as PersistPoco).IsValid    = false;
                        (item as PersistPoco).UpdateTime = DateTime.Now;
                        (item as PersistPoco).UpdateBy   = LoginUserInfo?.ITCode;
                        dynamic i = item;
                        DC.UpdateEntity(i);
                    }
                    else
                    {
                        foreach (var itempro in itemPros)
                        {
                            if (itempro.PropertyType.IsSubclassOf(typeof(TopBasePoco)))
                            {
                                itempro.SetValue(item, null);
                            }
                        }
                        dynamic i = item;
                        DC.DeleteEntity(i);
                    }
                }
                //需要添加的数据
                foreach (var item in toadd)
                {
                    if (item.GetType().IsSubclassOf(typeof(BasePoco)))
                    {
                        BasePoco ent = item as BasePoco;
                        if (ent.CreateTime == null)
                        {
                            ent.CreateTime = DateTime.Now;
                        }
                        if (string.IsNullOrEmpty(ent.CreateBy))
                        {
                            ent.CreateBy = LoginUserInfo?.ITCode;
                        }
                    }
                    DC.AddEntity(item);
                }

                DC.SaveChanges();
            }
        }
Example #46
0
        private void UpdateEquipmentLists()
        {
            try {
                fPackList.Items.Clear();
                fEquipList.Items.Clear();
                fOutList.Items.Clear();

                bool    onlyIcons = GlobalVars.nwrWin.InventoryOnlyIcons;
                Player  player    = GlobalVars.nwrGame.Player;
                NWField fld       = player.CurrentField;
                bool    blindness = player.Blindness;

                int debt = 0;
                fMode = IWMODE_GROUND;
                if (Collocutor != null)
                {
                    debt = player.GetDebt(Collocutor.Name);
                    if (Collocutor.IsTrader)
                    {
                        Building house = (Building)Collocutor.FindHouse();

                        if (house.Area.Contains(player.PosX, player.PosY))
                        {
                            fMode = IWMODE_INSHOP;
                        }
                        else
                        {
                            fMode = IWMODE_TRADER;
                        }
                    }
                    else
                    {
                        if (Collocutor.Mercenary)
                        {
                            fMode = IWMODE_MERCENARY;
                        }
                    }
                }

                fPayBtn.Enabled = (fMode != IWMODE_GROUND && debt != 0);

                switch (fMode)
                {
                case IWMODE_GROUND:
                {
                    EntityList items = player.Items;

                    int num5 = items.Count;
                    for (int i = 0; i < num5; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }

                        if (item.Equipment && item.InUse && fContainer == null)
                        {
                            AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons);
                        }
                        else
                        {
                            AddListItem(fPackList, item.GetName(blindness), item, onlyIcons);
                        }
                    }

                    ExtList <LocatedEntity> groundItems = fld.Items.SearchListByPos(player.PosX, player.PosY);

                    int num6 = groundItems.Count;
                    for (int i = 0; i < num6; i++)
                    {
                        Item item = (Item)groundItems[i];
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }
                        AddListItem(fOutList, item.GetName(blindness), item, onlyIcons);
                    }
                    groundItems.Dispose();
                }
                break;

                case IWMODE_TRADER:
                case IWMODE_INSHOP:
                {
                    EntityList items = player.Items;

                    int num3 = items.Count;
                    for (int i = 0; i < num3; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }

                        if (item.Equipment && item.InUse && fContainer == null)
                        {
                            AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons);
                        }
                        else
                        {
                            if (item.Ware)
                            {
                                AddListItem(fPackList, item.GetName(blindness) + " (" + Convert.ToString((int)item.GetTradePrice(Collocutor, player)) + "$)", item, onlyIcons);
                            }
                            else
                            {
                                AddListItem(fPackList, item.GetName(blindness), item, onlyIcons);
                            }
                        }
                    }

                    Building house = fld.FindBuilding(player.PosX, player.PosY);
                    if (house != null)
                    {
                        if (debt > 0)
                        {
                            house.SwitchDoors(DoorState.Closed);
                        }
                        else
                        {
                            house.SwitchDoors(DoorState.Opened);
                        }
                        ExtList <LocatedEntity> groundItems = fld.Items.SearchListByArea(house.Area);

                        int num4 = groundItems.Count;
                        for (int i = 0; i < num4; i++)
                        {
                            Item item = (Item)groundItems[i];
                            item.Identified = true;
                            AddListItem(fOutList, item.GetName(blindness) + " (" + Convert.ToString((int)item.GetTradePrice(player, Collocutor)) + "$)", item, onlyIcons);
                        }

                        groundItems.Dispose();
                    }
                }
                break;

                case IWMODE_MERCENARY:
                {
                    EntityList items = player.Items;

                    int num = items.Count;
                    for (int i = 0; i < num; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }
                        if (item.Equipment && item.InUse && fContainer == null)
                        {
                            AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons);
                        }
                        else
                        {
                            if (item.Ware)
                            {
                                AddListItem(fPackList, item.GetName(blindness) + " (" + Convert.ToString(item.Price) + "$)", item, onlyIcons);
                            }
                            else
                            {
                                AddListItem(fPackList, item.GetName(blindness), item, onlyIcons);
                            }
                        }
                    }
                    items = Collocutor.Items;

                    int num2 = items.Count;
                    for (int i = 0; i < num2; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        AddListItem(fOutList, item.GetName(blindness) + " (" + Convert.ToString(item.Price) + "$)", item, onlyIcons);
                    }
                }
                break;
                }

                if (fContainer != null)
                {
                    EntityList items = fContainer.Contents;

                    int num7 = items.Count;
                    for (int i = 0; i < num7; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }
                        AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons);
                    }
                }
            } catch (Exception ex) {
                Logger.Write("InventoryWindow.updateEquipmentLists(): " + ex.Message);
                throw ex;
            }
        }
Example #47
0
 /// <summary>
 /// Loads the items.
 /// </summary>
 public void LoadItems()
 {
     Items = new EntityList <RemoteResource>(context);
     Items.Template.ResourceSet = this;
     Items.Load();
 }
Example #48
0
 private static void InitEntitySetForLoad(Entity owner, EntitySetModel entitySetModel, EntityList list)
 {
     //设置EntitySet成员, eg: Order.Items
     ref EntityMember m = ref owner.GetMember(entitySetModel.MemberId);
Example #49
0
        public async Task <IActionResult> Get([FromQuery(Name = "skip")] int skip = 0, [FromQuery(Name = "take")] int take = 10, [FromQuery(Name = "sortBy")] string sortBy = "StateName", [FromQuery(Name = "sortDescending")] bool sortDescending = false)
        {
            try
            {
                List <TableRatingFactor> lstTableRatingFactor = new List <TableRatingFactor>();
                lstTableRatingFactor.Add(new TableRatingFactor
                {
                    TableRatingFactorsID = 1,
                    TableName            = "Table 1",
                    RatingFactor1        = "Age",
                    Dimension1           = "0.5",
                    RatingFactor2        = "AGE_ENTRY",
                    Dimension2           = "0.89",
                    RatingFactor3        = "PH_ AGE_ENTRY",
                    Dimension3           = "0.98",
                    RatingFactor4        = "GENDER",
                    Dimension4           = "1.25",
                });
                lstTableRatingFactor.Add(new TableRatingFactor
                {
                    TableRatingFactorsID = 2,
                    TableName            = "Table 2",
                    RatingFactor1        = "Age",
                    Dimension1           = "0.5",
                    RatingFactor2        = "AGE_ENTRY",
                    Dimension2           = "0.89",
                    RatingFactor3        = "PH_ AGE_ENTRY",
                    Dimension3           = "0.98",
                    RatingFactor4        = "GENDER",
                    Dimension4           = "1.25",
                });
                lstTableRatingFactor.Add(new TableRatingFactor
                {
                    TableRatingFactorsID = 3,
                    TableName            = "Table 3",
                    RatingFactor1        = "AGE_ENTRY",
                    Dimension1           = "2.02",
                    RatingFactor2        = "PREMIUM_STATUS",
                    Dimension2           = "3.35",
                    RatingFactor3        = "DURATION_IF_M",
                    Dimension3           = "5.24",
                    RatingFactor4        = "UNDERWRITING_MODEL",
                    Dimension4           = "2.658",
                });
                lstTableRatingFactor.Add(new TableRatingFactor
                {
                    TableRatingFactorsID = 4,
                    TableName            = "Table 4",
                    RatingFactor1        = "PREM__FREQ",
                    Dimension1           = "0.24",
                    RatingFactor2        = "ANNUITY_FREQ",
                    Dimension2           = "0.325",
                    RatingFactor3        = "PLAN",
                    Dimension3           = "3.21",
                    RatingFactor4        = "POL_TYPE",
                    Dimension4           = "8.02",
                });
                lstTableRatingFactor.Add(new TableRatingFactor
                {
                    TableRatingFactorsID = 5,
                    TableName            = "Table 5",
                    RatingFactor1        = "TAX_CLASS",
                    Dimension1           = "2",
                    RatingFactor2        = "MEMBER_TYPE",
                    Dimension2           = "7",
                    RatingFactor3        = "PREM_FREQ",
                    Dimension3           = "8",
                    RatingFactor4        = "COMM_TYPE",
                    Dimension4           = "9",
                });

                lstTableRatingFactor.Add(new TableRatingFactor
                {
                    TableRatingFactorsID = 6,
                    TableName            = "Table 6",
                    RatingFactor1        = "INCOME",
                    Dimension1           = "1.20",
                    RatingFactor2        = "SEC",
                    Dimension2           = "3.20",
                    RatingFactor3        = "INCOME",
                    Dimension3           = "3.20",
                    RatingFactor4        = "EDUCATION",
                    Dimension4           = "10.23",
                });
                lstTableRatingFactor.Add(new TableRatingFactor
                {
                    TableRatingFactorsID = 7,
                    TableName            = "Table 7",
                    RatingFactor1        = "OCC_CLASS",
                    Dimension1           = "4.0021",
                    RatingFactor2        = "PREMIUM_STATUS",
                    Dimension2           = "3.02",
                    RatingFactor3        = "ANNUITY_FREQ",
                    Dimension3           = "20.3",
                    RatingFactor4        = "COMM_TYPE",
                    Dimension4           = "0.021",
                });
                lstTableRatingFactor.Add(new TableRatingFactor
                {
                    TableRatingFactorsID = 8,
                    TableName            = "Table 8",
                    RatingFactor1        = "Age",
                    Dimension1           = "0.5",
                    RatingFactor2        = "AGE_ENTRY",
                    Dimension2           = "0.89",
                    RatingFactor3        = "PH_ AGE_ENTRY",
                    Dimension3           = "0.98",
                    RatingFactor4        = "GENDER",
                    Dimension4           = "1.25",
                });
                lstTableRatingFactor.Add(new TableRatingFactor
                {
                    TableRatingFactorsID = 9,
                    TableName            = "Table 9",
                    RatingFactor1        = "AGE_ENTRY",
                    Dimension1           = "2.02",
                    RatingFactor2        = "PREMIUM_STATUS",
                    Dimension2           = "3.35",
                    RatingFactor3        = "DURATION_IF_M",
                    Dimension3           = "5.24",
                    RatingFactor4        = "UNDERWRITING_MODEL",
                    Dimension4           = "2.658",
                });

                var result = new EntityList <TableRatingFactor>
                {
                    Total    = lstTableRatingFactor.Count(),
                    Entities = lstTableRatingFactor,
                };
                return(this.Ok(result));
            }
            catch (Exception ex)
            {
                return(this.BadRequest(ex.Message));
            }
        }
Example #50
0
 public async Task <IActionResult> GetRefactors()
 {
     try
     {
         List <DropDown> lstDropDown = new List <DropDown>();
         lstDropDown.Add(new DropDown
         {
             Value = -1,
             Text  = "N/A"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 1,
             Text  = "AGE"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 2,
             Text  = "AGE_ENTRY"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 3,
             Text  = "PH_ AGE_ENTRY"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 4,
             Text  = "GENDER"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 5,
             Text  = "AGE_ENTRY"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 6,
             Text  = "PREMIUM_STATUS"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 7,
             Text  = "DURATION_IF_M"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 8,
             Text  = "UNDERWRITING_MODEL"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "PREM__FREQ"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "ANNUITY_FREQ"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "PLAN"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "POL_TYPE"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "TAX_CLASS"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "MEMBER_TYPE"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "PREM_FREQ"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "COMM_TYPE"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "INCOME"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "SEC"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "INCOME"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "EDUCATION"
         });
         lstDropDown.Add(new DropDown
         {
             Value = 9,
             Text  = "OCC_CLASS"
         });
         var result = new EntityList <DropDown>
         {
             Total    = lstDropDown.Count(),
             Entities = lstDropDown,
         };
         return(this.Ok(result));
     }
     catch (Exception ex)
     {
         return(this.BadRequest(ex.Message));
     }
 }
Example #51
0
        protected override void ShowPage()
        {
            var adminGroupInfo = AdminGroup.FindByID(this.usergroupid);

            this.disablepostctrl = false;
            if (adminGroupInfo != null)
            {
                this.disablepostctrl = adminGroupInfo.DisablePostctrl;
            }
            if (this.userid == -1)
            {
                this.forum    = new XForum();
                this.topic    = new Topic();
                this.postinfo = new Post();
                base.AddErrLine("您尚未登录");
                return;
            }
            if (this.postid == -1)
            {
                base.AddErrLine("无效的帖子ID");
                return;
            }
            //this.postinfo = Posts.GetPostInfo(this.topicid, this.postid);
            postinfo = Post.FindByID(postid);
            if (this.postinfo == null)
            {
                base.AddErrLine("不存在的帖子ID");
                return;
            }
            this.pagetitle   = ((String.IsNullOrEmpty(this.postinfo.Title)) ? "编辑帖子" : this.postinfo.Title);
            this.htmlon      = this.postinfo.HtmlOn;
            this.message     = this.postinfo.Message;
            this.isfirstpost = (this.postinfo.Layer == 0);
            if (this.topicid != this.postinfo.Tid || this.postinfo.Tid == -1)
            {
                base.AddErrLine("无效的主题ID");
                return;
            }
            //this.topic = Topics.GetTopicInfo(this.postinfo.Tid);
            topic = Topic.FindByID(postinfo.Tid);
            if (this.topic == null)
            {
                base.AddErrLine("不存在的主题ID");
                return;
            }
            if (this.topic.Special == 1 && this.postinfo.Layer == 0)
            {
                //修改为Xcode方法
                this.pollinfo       = Poll.FindByTid(topic.ID);
                this.polloptionlist = PollOption.FindAllByTid(topic.ID);
            }
            if (this.topic.Special == 4 && this.postinfo.Layer == 0)
            {
                this.debateinfo = Debate.FindByTid(this.topic.ID);
            }
            this.forumid   = this.topic.Fid;
            this.forum     = Forums.GetForumInfo(this.forumid);
            this.needaudit = UserAuthority.NeedAudit(forum.Fid, forum.Modnewposts, this.useradminid, this.userid, this.usergroupinfo, this.topic);
            if (this.forum == null || this.forum.Layer == 0)
            {
                base.AddErrLine("版块已不存在");
                this.forum = new XForum();
                return;
            }
            if (!this.forum.Password.IsNullOrEmpty() && Utils.MD5(this.forum.Password) != ForumUtils.GetCookie("forum" + this.forumid + "password"))
            {
                base.AddErrLine("本版块被管理员设置了密码");
                base.SetBackLink(base.ShowForumAspxRewrite(this.forumid, 0));
                return;
            }
            if (this.forum.ApplytopicType == 1)
            {
                this.topictypeselectoptions = Forums.GetCurrentTopicTypesOption(this.forum.Fid, this.forum.Topictypes);
            }
            this.customeditbuttons = Caches.GetCustomEditButtonList();
            if (!UserAuthority.CanEditPost(this.postinfo, this.userid, this.useradminid, ref this.msg))
            {
                base.AddErrLine(this.msg);
                return;
            }
            //string allowAttachmentType = Attachments.GetAllowAttachmentType(this.usergroupinfo, this.forum);
            this.attachextensions       = AttachType.GetAttachmentTypeArray(usergroupinfo, forum);
            this.attachextensionsnosize = AttachType.GetAttachmentTypeString(usergroupinfo, forum);
            int num = (this.userid > 0) ? Attachment.GetUploadFileSizeByuserid(this.userid) : 0;

            this.attachsize      = this.usergroupinfo.MaxSizeperday - num;
            this.canpostattach   = UserAuthority.PostAttachAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg);
            this.userinfo        = BBX.Entity.User.FindByID(this.userid);
            this.attachmentlist  = Attachment.FindAllByPid(this.postinfo.ID);
            this.attachmentcount = this.attachmentlist.Count;
            this.allowviewattach = UserAuthority.DownloadAttachment(this.forum, this.userid, this.usergroupinfo);
            this.smileyoff       = ((!DNTRequest.IsPost()) ? this.postinfo.SmileyOff : (forum.AllowSmilies ? 0 : 1));
            //this.allowimg = this.forum.Allowimgcode;
            this.parseurloff        = this.postinfo.ParseUrlOff;
            this.bbcodeoff          = this.usergroupinfo.AllowCusbbCode ? this.postinfo.BBCodeOff : 1;
            this.usesig             = this.postinfo.UseSig;
            this.userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
            if (this.bonusCreditsTrans > 0 && this.bonusCreditsTrans < 9)
            {
                this.bonusextcreditsinfo = Scoresets.GetScoreSet(this.bonusCreditsTrans);
                this.mybonustranscredits = Users.GetUserExtCredits(this.userid, this.bonusCreditsTrans);
            }
            if (!UserAuthority.VisitAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg))
            {
                base.AddErrLine(this.msg);
                return;
            }
            if (!Moderators.IsModer(this.useradminid, this.userid, this.forumid))
            {
                if (this.postinfo.PosterID != this.userid)
                {
                    base.AddErrLine("你并非作者, 且你当前的身份 \"" + this.usergroupinfo.GroupTitle + "\" 没有修改该帖的权限");
                    return;
                }
                if (this.config.Edittimelimit > 0 && this.postinfo.PostDateTime.AddMinutes(this.config.Edittimelimit) < DateTime.Now)
                {
                    base.AddErrLine("抱歉, 系统规定只能在帖子发表" + this.config.Edittimelimit + "分钟内才可以修改");
                    return;
                }
                if (this.config.Edittimelimit == -1)
                {
                    base.AddErrLine("抱歉,系统不允许修改帖子");
                    return;
                }
                this.alloweditpost = true;
            }
            else
            {
                if (adminGroupInfo != null && adminGroupInfo.AllowEditPost && Moderators.IsModer(this.useradminid, this.userid, this.forumid))
                {
                    this.alloweditpost = true;
                }
            }
            if (!this.alloweditpost && this.postinfo.PosterID != this.userid)
            {
                base.AddErrLine("您当前的身份没有编辑帖子的权限");
                return;
            }
            if (this.postinfo.Layer == 0)
            {
                this.canhtmltitle = this.usergroupinfo.AllowHtmlTitle;
            }
            if (Topics.GetMagicValue(this.topic.Magic, MagicType.HtmlTitle) == 1)
            {
                this.htmltitle = Topics.GetHtmlTitle(this.topic.ID).Replace("\"", "\\\"").Replace("'", "\\'");
            }
            this.enabletag = config.Enabletag && forum.AllowTag;
            if (this.enabletag && Topics.GetMagicValue(this.topic.Magic, MagicType.TopicTag) == 1)
            {
                foreach (var item in Tag.GetTagsListByTopic(this.topic.ID))
                {
                    if (item.OrderID > -1)
                    {
                        this.topictags += string.Format(" {0}", item.Name);
                    }
                }
                this.topictags = this.topictags.Trim();
            }
            this.userGroupInfoList.Sort((x, y) => x.Readaccess - y.Readaccess + (y.ID - x.ID));
            if (this.ispost)
            {
                base.SetBackLink("editpost.aspx?topicid=" + this.postinfo.Tid + "&postid=" + this.postinfo.ID);
                if (ForumUtils.IsCrossSitePost())
                {
                    base.AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                this.SetPostInfo(adminGroupInfo, this.userinfo, DNTRequest.GetString("htmlon").ToInt(0) == 1);
                if (base.IsErr())
                {
                    return;
                }
                //Posts.UpdatePost(this.postinfo);
                postinfo.Update();
                var stringBuilder = this.SetAttachmentInfo();
                if (base.IsErr())
                {
                    return;
                }
                CreditsFacade.UpdateUserCredits(this.userid);
                string url;
                if (this.topic.Special == 4)
                {
                    url = Urls.ShowTopicAspxRewrite(this.topic.ID, this.pageid);
                }
                else
                {
                    if (DNTRequest.GetQueryString("referer") != "")
                    {
                        url = string.Format("showtopic.aspx?page=end&forumpage={2}&topicid={0}#{1}", this.topic.ID, this.postinfo.ID, this.forumpageid);
                    }
                    else
                    {
                        if (this.pageid > 1)
                        {
                            if (this.config.Aspxrewrite == 1)
                            {
                                url = string.Format("showtopic-{0}-{2}{1}#{3}", new object[]
                                {
                                    this.topic.ID,
                                    this.config.Extname,
                                    this.pageid,
                                    this.postinfo.ID
                                });
                            }
                            else
                            {
                                url = string.Format("showtopic.aspx?topicid={0}&forumpage={3}&page={2}#{1}", new object[]
                                {
                                    this.topic.ID,
                                    this.postinfo.ID,
                                    this.pageid,
                                    this.forumpageid
                                });
                            }
                        }
                        else
                        {
                            if (this.config.Aspxrewrite == 1)
                            {
                                url = string.Format("showtopic-{0}{1}", this.topic.ID, this.config.Extname);
                            }
                            else
                            {
                                url = string.Format("showtopic.aspx?topicid={0}&forumpage={1}", this.topic.ID, this.forumpageid);
                            }
                        }
                    }
                }
                base.SetUrl(url);
                if (stringBuilder.Length > 0)
                {
                    base.SetMetaRefresh(5);
                    base.SetShowBackLink(true);
                    if (this.infloat == 1)
                    {
                        base.AddErrLine(stringBuilder.ToString());
                        return;
                    }
                    stringBuilder.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>编辑帖子成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr>");
                    stringBuilder.Append("</table>");
                    base.AddMsgLine(stringBuilder.ToString());
                }
                else
                {
                    if (this.postinfo.Layer == 0)
                    {
                        base.SetMetaRefresh(2, url);
                    }
                    else
                    {
                        base.SetMetaRefresh();
                    }
                    base.SetShowBackLink(false);
                    if (this.useradminid != 1 && (this.needaudit || this.topic.DisplayOrder == -2 || this.postinfo.Invisible == 1))
                    {
                        if (this.postinfo.Layer == 0)
                        {
                            base.SetUrl(base.ShowForumAspxRewrite(this.forumid, this.forumpageid));
                        }
                        else
                        {
                            base.SetUrl(base.ShowTopicAspxRewrite(this.topic.ID, this.forumpageid));
                        }
                        base.AddMsgLine("编辑成功, 但需要经过审核才可以显示");
                    }
                    else
                    {
                        base.MsgForward("editpost_succeed");
                        base.AddMsgLine("编辑帖子成功, 返回该主题");
                    }
                }
                if (this.postinfo.Layer == 0)
                {
                    ForumUtils.DeleteTopicCacheFile(this.topic.ID);
                    return;
                }
            }
            else
            {
                base.AddLinkCss(BaseConfigs.GetForumPath + "templates/" + this.templatepath + "/editor.css", "css");
            }
        }
Example #52
0
 public override string ToString()
 {
     return(Entity.ToString() + " list: " + " " + EntityList.ToString());
 }
Example #53
0
        /// <summary>
        /// Activity heavy lifting.
        /// </summary>
        /// <param name="context"></param>
        protected override void DoWork(CodeActivityContext context)
        {
            // This processing is intended for the Plan-of-the-Day feature and does not necessarily support any other usage
            // The passed Site.SIT_ID must be for a version zero prescription record (aka the 'tip' or 'current' version)
            // Prescribed fraction dose must not be zero and must be uniform
            // If fractionation details records exist for the prescription (Site_FractionDetails) then the passed deltaFraction must be negative
            // For Plan-of-the-Day the deltaFraction value is -1
            // The valid range of prescribed fractions after the adjustment is 0 to 100 inclusive

            // Activity inputs
            int patId                  = PatId.Get(context);
            int sitId                  = Sitid.Get(context);
            int deltaFraction          = DeltaFraction.Get(context);
            ImpacPersistenceManager pm = PersistenceManager.Expression != null
                                             ? PersistenceManager.Get(context)
                                             : PM;

            // Activity output
            FractionsChanged.Set(context, false); // Initialize the Activity output to False

            // Don't do anything if deltaFraction is zero i.e., no adjustment requested
            if (deltaFraction == 0)
            {
                return;
            }

            // Get the Rad Rx to be updated
            PrescriptionSite site = PrescriptionSite.GetEntityByID(sitId, pm);

            // Determine whether the request is valid for this prescription

            // If the Site record no longer exists or the record's version is no longer zero (because a version roll has occurred)
            // then do not proceed with updates to this prescription
            if (site.IsNullEntity || site.Version != 0)
            {
                return;
            }

            // If the prescribed fraction dose is zero or non-uniform then do not proceed with updates to this prescription
            // (Dose_Tx is zero when fraction dose is non-uniform; check for negative dose is excessive but doesn't hurt)
            if (site.Dose_Tx <= 0)
            {
                return;
            }

            // If the adjusted number of fractions won't be valid (must be between 0 and 100 inclusive)
            // then do not proceed with updates to this prescription
            int newFractions = site.Fractions + deltaFraction;

            if ((newFractions < 0) || (newFractions > 100))
            {
                return;
            }

            // Get the fraction and wave detail records (if any) for this prescription
            if (site.FxType == 2)
            {
                // When there are fraction detail records, FxType is 2
                EntityList <SiteFractionDetails> siteFractionDetails = SiteFractionDetails.GetSiteFractionDetailsEntitiesBySitId(sitId, pm, QueryStrategy.DataSourceOnly);

                // There can be wave detail records only when there are fraction detail records
                if (siteFractionDetails.Count > 0)
                {
                    EntityList <SiteWaveDetails> siteWaveDetails = SiteWaveDetails.GetSiteWaveDetailsEntitiesBySitId(sitId, pm, QueryStrategy.DataSourceOnly);
                }

                // If there are fraction and/or wave detail records and deltaFraction > 0
                // then do NOT proceed because inserting fraction and/or wave detail records is NOT supported here
                if (deltaFraction > 0 && siteFractionDetails.Count > 0)
                {
                    return;
                }
            }

            // The request is valid for this prescription so make the adjustments

            // Prepare for edit, including version roll if necessary
            var revisionedSite = (PrescriptionSite)site.PrepareEntityForEdit("PlanOfTheDay", true);

            // Adjust prescribed total dose and prescribed number of fractions
            revisionedSite.Dose_Ttl  = revisionedSite.Dose_Tx * newFractions;
            revisionedSite.Fractions = (short)newFractions;

            // If the prescription is approved, maintain the approval status and approving staff
            // but set the approval date/time stamp to now
            if (revisionedSite.Sanct_Id.HasValue)
            {
                revisionedSite.Sanct_DtTm = DateTime.Now;
            }

            if (revisionedSite.FxType == 2)
            {
                // Manage the fraction details, fraction specific Notes and wave details records (if any)
                RemoveExcessSiteFractionDetailsAndNotes(pm, revisionedSite);
                RemoveUnreferencedSiteWaveDetails(pm, revisionedSite);

                // If fractions were reduced to zero
                // then there will be no details records when the update is complete so change FxType to 0 (no details records)
                if (revisionedSite.Fractions == 0)
                {
                    revisionedSite.FxType = 0;
                }
            }

            try
            {
                pm.SaveChanges();
            }
            catch
            {
                return;
            }

            FractionsChanged.Set(context, true);
        }
Example #54
0
        private void loadOperationStandBook_Completed(object sender, EventArgs e)
        {
            ProjectTotalMonay.Clear();
            ProjectPartMoney.Clear();
            ProjectTax.Clear();

            LoadOperation loadOperation = sender as LoadOperation;

            foreach (Web.Model.standbook standbook in loadOperation.Entities)
            {
                StandBookEntity lStandBookEntity = new StandBookEntity();
                lStandBookEntity.StandBook = standbook;
                lStandBookEntity.Update();

                string lProjectName = lStandBookEntity.ProjectName;

                decimal lTotalMoney;
                if (!ProjectTotalMonay.TryGetValue(lProjectName, out lTotalMoney))
                {
                    ProjectTotalMonay.Add(lProjectName, lStandBookEntity.TotalMoney.GetValueOrDefault(0));
                }

                decimal lPartMoney;
                if (ProjectPartMoney.TryGetValue(lProjectName, out lPartMoney))
                {
                    ProjectPartMoney[lProjectName] += lStandBookEntity.ThisPartMoney.GetValueOrDefault(0);
                }
                else
                {
                    ProjectPartMoney.Add(lProjectName, lStandBookEntity.ThisPartMoney.GetValueOrDefault(0));
                }

                decimal lTax;
                if (ProjectTax.TryGetValue(lProjectName, out lTax))
                {
                    ProjectTax[lProjectName] += lStandBookEntity.TotalTax;
                }
                else
                {
                    ProjectTax.Add(lProjectName, lStandBookEntity.TotalTax);
                }

                DateTime lDataTime;
                if (!ProjectStandBookDateTime.TryGetValue(lProjectName, out lDataTime))
                {
                    ProjectStandBookDateTime.Add(lProjectName, lStandBookEntity.PayTime.GetValueOrDefault());
                }

                //TaxPayerTypeEntityDictionary.Add(lTaxPayerTypeEntity.TaxPayerTypeId, lTaxPayerTypeEntity);
            }

            taxPayerSource = new EntityList <Web.Model.taxpayer>(documentManagerContext.taxpayers);
            taxPayerLoader = new DomainCollectionViewLoader <Web.Model.taxpayer>(
                LoadTaxPayerEntities,
                loadOperation_Completed);
            taxPayerView = new DomainCollectionView <Web.Model.taxpayer>(taxPayerLoader, taxPayerSource);


            using (this.taxPayerView.DeferRefresh())
            {
                this.taxPayerView.MoveToFirstPage();
            }
        }
Example #55
0
        public static List <APIMember> CreateChildren(APIPage Parent, IEnumerable <DoxygenEntity> Entities)
        {
            List <APIMember> Children = new List <APIMember>();
            Dictionary <APIFunctionKey, List <DoxygenEntity> > PendingFunctionGroups = new Dictionary <APIFunctionKey, List <DoxygenEntity> >();

            // List of autogenerated structs
            List <DoxygenEntity> GeneratedEntities = new List <DoxygenEntity>();

            // Parse the entities
            foreach (DoxygenEntity Entity in Entities)
            {
                if (Entity.Kind == "class" || Entity.Kind == "struct" || Entity.Kind == "union")
                {
                    if (Entity.Kind == "struct" && Entity.Name.Contains("_event") && Entity.Name.EndsWith("_Parms"))
                    {
                        GeneratedEntities.Add(Entity);
                    }
                    else
                    {
                        APIRecord Record = new APIRecord(Parent, Entity);
                        Record.Children.AddRange(CreateChildren(Record, Entity.Members));
                        Children.Add(Record);
                    }
                }
                else if (Entity.Kind == "function")
                {
                    APIFunctionKey FunctionKey = APIFunctionKey.FromEntity(Parent, Entity);
                    if (!Program.IgnoredFunctionMacros.Contains(FunctionKey.Name))
                    {
                        List <DoxygenEntity> EntityList;
                        if (!PendingFunctionGroups.TryGetValue(FunctionKey, out EntityList))
                        {
                            EntityList = new List <DoxygenEntity>();
                            PendingFunctionGroups.Add(FunctionKey, EntityList);
                        }
                        EntityList.Add(Entity);
                    }
                }
                else if (Entity.Kind == "variable")
                {
                    if (IsConstantVariable(Entity))
                    {
                        Children.Add(new APIConstantVariable(Parent, Entity));
                    }
                    else
                    {
                        Children.Add(new APIVariable(Parent, Entity.Node));
                    }
                }
                else if (Entity.Kind == "typedef")
                {
                    Children.Add(new APITypeDef(Parent, Entity));
                }
                else if (Entity.Kind == "enum")
                {
                    if (Entity.Name != null && Entity.Name.StartsWith("@"))
                    {
                        // It's an enum constant
                        Children.AddRange(APIConstantEnum.Read(Parent, Entity));
                    }
                    else
                    {
                        // It's an enum
                        Children.Add(new APIEnum(Parent, Entity, Entity.Name));
                    }
                }
            }

            // Fixup the functions
            foreach (KeyValuePair <APIFunctionKey, List <DoxygenEntity> > PendingFunctionGroup in PendingFunctionGroups)
            {
                if (PendingFunctionGroup.Value.Count == 1)
                {
                    APIFunction Function = new APIFunction(Parent, PendingFunctionGroup.Value[0], PendingFunctionGroup.Key);
                    Children.Add(Function);
                }
                else
                {
                    APIFunctionGroup FunctionGroup = new APIFunctionGroup(Parent, PendingFunctionGroup.Key, PendingFunctionGroup.Value);
                    Children.Add(FunctionGroup);
                }
            }

            // Attach all the autogenerated structures to their parent functions
            foreach (DoxygenEntity Entity in GeneratedEntities)
            {
                if (!CreateParametersStruct(Parent, Children, Entity))
                {
                    APIRecord Record = new APIRecord(Parent, Entity);
                    Record.Children.AddRange(CreateChildren(Record, Entity.Members));
                    Children.Add(Record);
                }
            }

            // Sort the children by name
            Children.Sort((x, y) => String.Compare(x.Name, y.Name));
            return(Children);
        }
Example #56
0
 public void SetProperty(TLayout layout, EntityList <TEntity> value)
 {
     _property.Set(layout, _propertyConverter(value));
 }
Example #57
0
 public SegmentListProperty(EntityList <TSegment> entityList)
 {
     _entityList = entityList;
 }
Example #58
0
 private List <(EntityId entityId, PointF bounce)> GetCollisionsInfo(EntityList entities) =>
Example #59
0
 public void ClearEntityList()
 {
     EntityList?.Clear();
 }
Example #60
0
 private void PutToBag(Item aItem, EntityList aFromList)
 {
     aItem.InUse = false;
     aFromList.Extract(aItem);
     fContainer.Contents.Add(aItem);
 }