Exemple #1
0
        protected virtual ProductionType GetProdcutionTypeFromReader(IDataReader reader)
        {
            EntityConverter <ProductionType> productionTypeEntity = new EntityConverter <ProductionType>();
            ProductionType productionType = productionTypeEntity.Convert(reader);

            return(productionType);
        }
Exemple #2
0
 public void CreateProductionType(ProductionType productionType)
 {
     using (DMSEntities dmsEntities = this.dmsEntities)
     {
         dmsEntities.ProductionType.Add(productionType);
         dmsEntities.SaveChanges();
     }
 }
        public IActionResult SavePersonItems(PersonRecieptItem item)
        {
            // items.Add(item);
            Fish           fish       = _context.Fishes.Find(item.FishID);
            Boat           boat       = _context.Boats.Find(item.BoatID);
            ProductionType production = _context.ProductionTypes.Find(item.ProductionTypeID);
            var            res        = new { boatName = boat.BoatName, productionName = production.ProductionName, fishName = fish.FishName, qty = item.Qty, unitPrice = item.UnitPrice, total = (decimal)item.Qty * item.UnitPrice };

            return(Json(res));
        }
Exemple #4
0
 public ServiceInvocationResult createProduCtionType(ProductionType productionType)
 {
     try
     {
         this.simpleEntitiesManager.CreateProductionType(productionType);
         return(new ServiceInvocationResult((int)ServiceInvocationResultCode.OK, null, null, null));
     }
     catch (Exception ex)
     {
         return(new ServiceInvocationResult((int)ServiceInvocationResultCode.InternalError, ex.Message, ex.StackTrace, ex));
     }
 }
 /// <summary>
 /// 增加
 /// </summary>
 /// <param name="ProductionType">ProductionType实体对象</param>
 /// <returns>int值,返回自增ID</returns>
 public int AddReturnId(ProductionType model)
 {
     SqlParameter[] param = new SqlParameter[]
     {
         new SqlParameter("@ProductionTypeName", model.ProductionTypeName),
         new SqlParameter("@Decription", model.Decription),
         new SqlParameter("@ParentId", model.ParentId),
         new SqlParameter("@OrderIndex", model.OrderIndex),
         new SqlParameter("@IsDelete", model.IsDelete)
     };
     return(Convert.ToInt32(DBHelper.ExecuteScalar("ProductionType_AddReturnId", param)));
 }
 /// <summary>
 /// 增加
 /// </summary>
 /// <param name="ProductionType">ProductionType实体对象</param>
 /// <returns>bool值,判断是否操作成功</returns>
 public bool Add(ProductionType model)
 {
     SqlParameter[] param = new SqlParameter[]
     {
         new SqlParameter("@ProductionTypeName", model.ProductionTypeName),
         new SqlParameter("@Decription", model.Decription),
         new SqlParameter("@ParentId", model.ParentId),
         new SqlParameter("@OrderIndex", model.OrderIndex),
         new SqlParameter("@IsDelete", model.IsDelete)
     };
     return(DBHelper.ExecuteNonQuery("ProductionType_Add", param));
 }
        /// <summary>
        /// 数据访问通过条件查询并分页排序
        /// </summary>
        /// <param name="WhereString">查询条件</param>
        /// <param name="PageIndex">当前页码</param>
        /// <param name="PageSize">页大小(每页显示多少条数据)</param>
        /// <param name="OrderString">排序条件(排序条件为必须参数)</param>
        /// <returns>ProductionType实体类对象</returns>
        public List <ProductionType> SelectByWhereAndPage(string WhereString, int PageIndex, int PageSize, string OrderString, out int TotalCount)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@where", WhereString),
                new SqlParameter("@pageIndex", PageIndex),
                new SqlParameter("@pageSize", PageSize),
                new SqlParameter("@orderString", OrderString),
                new SqlParameter("@TotalCount", ParameterDirection.Output)
            };
            List <ProductionType> list  = new List <ProductionType>();
            ProductionType        model = null;

            using (SqlDataReader dr = DBHelper.RunProcedure("ProductionType_SelectByWhereAndPage", param))
            {
                while (dr.Read())
                {
                    model = new ProductionType();
                    model.ProductionTypeId = Convert.ToInt32(dr["ProductionTypeId"]);
                    if (DBNull.Value != dr["ProductionTypeName"])
                    {
                        model.ProductionTypeName = dr["ProductionTypeName"].ToString();
                    }
                    if (DBNull.Value != dr["Decription"])
                    {
                        model.Decription = dr["Decription"].ToString();
                    }
                    if (DBNull.Value != dr["ParentId"])
                    {
                        model.ParentId = Convert.ToInt32(dr["ParentId"]);
                    }
                    if (DBNull.Value != dr["OrderIndex"])
                    {
                        model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]);
                    }
                    if (DBNull.Value != dr["IsDelete"])
                    {
                        model.IsDelete = Convert.ToBoolean(dr["IsDelete"]);
                    }
                    list.Add(model);
                }
                if (dr.NextResult() && dr.Read())
                {
                    TotalCount = Convert.ToInt32(dr["TotalCount"]);
                }
                else
                {
                    TotalCount = 0;
                }
            }
            return(list);
        }
Exemple #8
0
        public ProductionSystem(ProblemType problemType, ProductionType productionType, SelectionMethod selectionMethod, int[] parts, int[] parts_prefer)
        {
            this.problemType     = problemType;
            this.productionType  = productionType;
            this.SelectionMethod = selectionMethod;

            this.Total_Parts_No = parts.Length;
            this.leaveTimes     = new double[Total_Parts_No, Total_Machine_No];
            this.Parts_Sequence = parts;

            this.Parts_Preference = parts_prefer;
            this.Machine6Record   = new int[Total_Parts_No];
        }
        public async Task <IActionResult> Create(ProductionType model)
        {
            if (ModelState.IsValid)
            {
                db.ProductionTypes.Add(model);
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(model));
            }
        }
Exemple #10
0
        public List <ProductionType> GetProductionTypeList()
        {
            List <ProductionType> lstProductionType = null;
            ProductionType        productType;

            try
            {
                ProcParam param = new ProcParam(3)
                {
                    ProcedureName = "DO_PACK.LOV_PROD_TYPE"
                };
                param.AddParamRefCursor(0, "io_cursor");
                param.AddParamInput(1, "strFindAll", DBNull.Value);
                param.AddParamInput(2, "strSEQ_NO", DBNull.Value);

                OraDataReader.Instance.OraReader = GlobalDB.Instance.DataAc.ExecuteDataReader(param);

                ////this.executionTime = GlobalDB.Instance.DataAc.ExecuteTime;

                if (OraDataReader.Instance.OraReader.HasRows)
                {
                    lstProductionType = new List <ProductionType>();

                    OraDataReader.Instance.OraReader.FetchSize = OraDataReader.Instance.OraReader.RowSize * 1000;

                    while (OraDataReader.Instance.OraReader.Read())
                    {
                        productType = new ProductionType();

                        productType.SEQ_NO   = OraDataReader.Instance.GetString("SEQ_NO");
                        productType.NAME     = OraDataReader.Instance.GetString("NAME");
                        productType.REMARK   = OraDataReader.Instance.GetString("REMARK");
                        productType.REC_STAT = (OraDataReader.Instance.GetString("REC_STAT").ToUpper() == "Y");

                        lstProductionType.Add(productType);
                    }
                }

                // always call Close when done reading.
                OraDataReader.Instance.Close();
            }
            catch (Exception ex)
            {
                lstProductionType = null;
                throw ex;
            }

            return(lstProductionType);
        }
        public async Task <IActionResult> Edit(ProductionType model)
        {
            if (ModelState.IsValid)
            {
                // db.ProductionTypes.Update(model);
                db.Entry(model).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(model));
            }
        }
Exemple #12
0
 FacilityType(string name, ProductionType pt, int buildProg, int buildSupInitial, int hoursProduce, int minPayout, int maxPayout, int upgrades, int maxRewardModifier,
              int upgradeCostResearch, int upgradeCostBuild, int maxWorkers, Skill skillRequired)
 {
     this.name                = name;
     this.pt                  = pt;
     this.skillRequired       = skillRequired;
     this.buildProg           = buildProg;
     this.buildSupInitial     = buildSupInitial;
     this.hoursProduce        = hoursProduce;
     this.minPayout           = minPayout;
     this.maxPayout           = maxPayout;
     this.upgrades            = upgrades;
     this.maxRewardModifier   = maxRewardModifier;
     this.upgradeCostResearch = upgradeCostResearch;
     this.upgradeCostBuild    = upgradeCostBuild;
     this.maxWorkers          = maxWorkers;
 }
        public IActionResult SaveItems(MerchantRecieptItemVm item)
        {
            // items.Add(item);
            Fish           fish             = _context.Fishes.Find(item.FishID);
            Boat           boat             = _context.Boats.Find(item.BoatID);
            ProductionType production       = _context.ProductionTypes.Find(item.ProductionTypeID);
            var            BoatOwnerRecItem = _context.BoatOwnerItems.Include(i => i.Fish).Where(i => i.BoatOwnerRecieptID == item.BoatOwnerRecID && i.Fish.FishName == fish.FishName && i.BoatOwnerReciept.BoatID == boat.BoatID && i.ProductionTypeID == production.ProductionTypeID).FirstOrDefault();

            if (BoatOwnerRecItem.Qty >= item.Qty)
            {
                var res = new { boatName = boat.BoatName, productionName = production.ProductionName, fishName = fish.FishName, qty = item.Qty, unitPrice = item.UnitPrice, total = item.Qty * item.UnitPrice, original = BoatOwnerRecItem.Qty };
                return(Json(res));
            }
            else
            {
                return(Json(new { message = "moreqty" }));
            }
        }
Exemple #14
0
        // queues a production at the given city if, it is valid
        private void QueueProduction(City city, string name)
        {
            ProductionType prodType = ProductionType.BUILDING;

            if (name.StartsWith("BUILDING_"))
            {
                prodType = ProductionType.BUILDING;
            }
            else if (name.StartsWith("UNIT_"))
            {
                prodType = ProductionType.UNIT;
            }
            else
            {
                return;
            }

            Production proposedProd;

            switch (prodType)
            {
            case ProductionType.UNIT:
                proposedProd = new Production(Controllers.Data.Unit.GetUnit(name));
                city.ProductionQueue.Enqueue(proposedProd);
                break;

            case ProductionType.BUILDING:
                // don't queue more than one of the same building
                foreach (Production prod in city.ProductionQueue)
                {
                    if (prod.Name == name)
                    {
                        return;
                    }
                }
                proposedProd = new Production(Controllers.Data.Building.GetBuilding(name));
                city.ProductionQueue.Enqueue(proposedProd);
                break;
            }

            UpdateCity(city);
        }
Exemple #15
0
        public string ProductionTypeName(string prdtypeNo)
        {
            if (this.lstProductionType == null)
            {
                return(string.Empty);
            }

            ProductionType pdtType = lstProductionType.Find(delegate(ProductionType _pdtType)
            {
                return(_pdtType.SEQ_NO == prdtypeNo);
            });

            if (pdtType != null)
            {
                return(pdtType.NAME);
            }
            else
            {
                return(string.Empty);
            }
        }
        /// <summary>
        /// 通过条件查询
        /// </summary>
        /// <param name="WhereString">查询条件</param>
        /// <returns>ProductionType实体类对象</returns>
        public List <ProductionType> SelectByWhere(string WhereString)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@where", WhereString)
            };
            List <ProductionType> list  = new List <ProductionType>();
            ProductionType        model = null;

            using (SqlDataReader dr = DBHelper.RunProcedure("ProductionType_SelectByWhere", param))
            {
                while (dr.Read())
                {
                    model = new ProductionType();
                    model.ProductionTypeId = Convert.ToInt32(dr["ProductionTypeId"]);
                    if (DBNull.Value != dr["ProductionTypeName"])
                    {
                        model.ProductionTypeName = dr["ProductionTypeName"].ToString();
                    }
                    if (DBNull.Value != dr["Decription"])
                    {
                        model.Decription = dr["Decription"].ToString();
                    }
                    if (DBNull.Value != dr["ParentId"])
                    {
                        model.ParentId = Convert.ToInt32(dr["ParentId"]);
                    }
                    if (DBNull.Value != dr["OrderIndex"])
                    {
                        model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]);
                    }
                    if (DBNull.Value != dr["IsDelete"])
                    {
                        model.IsDelete = Convert.ToBoolean(dr["IsDelete"]);
                    }
                    list.Add(model);
                }
            }
            return(list);
        }
        /// <summary>
        /// 通过Id查询
        /// </summary>
        /// <param name="Id">主键Id</param>
        /// <returns>ProductionType实体类对象</returns>
        public ProductionType SelectById(int Id)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@ProductionTypeId", Id)
            };
            ProductionType model = new ProductionType();

            using (SqlDataReader dr = DBHelper.RunProcedure("ProductionType_SelectById", param))
            {
                if (dr.Read())
                {
                    model.ProductionTypeId = Convert.ToInt32(dr["ProductionTypeId"]);
                    if (DBNull.Value != dr["ProductionTypeName"])
                    {
                        model.ProductionTypeName = dr["ProductionTypeName"].ToString();
                    }
                    if (DBNull.Value != dr["Decription"])
                    {
                        model.Decription = dr["Decription"].ToString();
                    }
                    if (DBNull.Value != dr["ParentId"])
                    {
                        model.ParentId = Convert.ToInt32(dr["ParentId"]);
                    }
                    if (DBNull.Value != dr["OrderIndex"])
                    {
                        model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]);
                    }
                    if (DBNull.Value != dr["IsDelete"])
                    {
                        model.IsDelete = Convert.ToBoolean(dr["IsDelete"]);
                    }
                }
            }
            return(model);
        }
Exemple #18
0
 public List <Item> GetItems(BrandEnum brand, FlavorEnum flavor, ProductionType type, ProductionDetail detail)
 {
     throw new NotImplementedException();
 }
Exemple #19
0
 public virtual void spawnUnit(ProductionType type)
 {
     switch (type)
     {
         case ProductionType.Boss :
             switch (Player.Civilization)
             {
                 case CivilizationType.EII:
                     BossEII newBossEII = new BossEII(Player, Position);
                     Player.Boss = newBossEII;
                     Position.Units.Add(newBossEII);
                     break;
                 case CivilizationType.INFO:
                     BossINFO newBossINFO = new BossINFO(Player, Position);
                     Player.Boss = newBossINFO;
                     Position.Units.Add(newBossINFO);
                     break;
             }
             break;
         case ProductionType.Student:
             switch (Player.Civilization)
             {
                 case CivilizationType.EII:
                     StudentEII newStudentEII = new StudentEII(Player, Position);
                     Player.Students.Add(newStudentEII);
                     Position.addUnit(newStudentEII);
                     break;
                 case CivilizationType.INFO:
                     StudentINFO newStudentINFO = new StudentINFO(Player, Position);
                     Player.Students.Add(newStudentINFO);
                     Position.addUnit(newStudentINFO);
                     break;
             }
             break;
         case ProductionType.Teacher :
             switch (Player.Civilization)
             {
                 case CivilizationType.EII:
                     TeacherEII newTeacherEII = new TeacherEII(Player, Position);
                     Player.Teachers.Add(newTeacherEII);
                     Position.addUnit(newTeacherEII);
                     break;
                 case CivilizationType.INFO:
                     TeacherINFO newTeacherINFO = new TeacherINFO(Player, Position);
                     Player.Teachers.Add(newTeacherINFO);
                     Position.addUnit(newTeacherINFO);
                     break;
             }
             break;
     }
     Current_prod = ProductionType.None;
 }
        public Expression <Func <ItemEntity, bool> > GetItemExp(BrandEnum brand, FlavorEnum flavor, PackageEnum package, ProductionType productionType, ProductionDetail productionDetailType)
        {
            Expression <Func <ItemEntity, bool> > itemWhere = c => true;

            if (brand != BrandEnum.Null)
            {
                var prefix = itemWhere.Compile();
                itemWhere = c => prefix(c) && c.Brand == (int)brand;
            }
            if (flavor != FlavorEnum.Null)
            {
                var prefix = itemWhere.Compile();
                itemWhere = c => prefix(c) && c.Flavor == (int)flavor;
            }
            if (package != PackageEnum.Null)
            {
                var prefix = itemWhere.Compile();
                itemWhere = c => prefix(c) && c.Package == (int)package;
            }
            if (productionType != ProductionType.Null)
            {
                var prefix = itemWhere.Compile();
                itemWhere = c => prefix(c) && c.ProductionType == (int)productionType;
            }
            if (productionDetailType != ProductionDetail.Null)
            {
                var prefix = itemWhere.Compile();
                itemWhere = c => prefix(c) && c.ProductionDetailType == (int)productionDetailType;
            }

            return(itemWhere);
        }
Exemple #21
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="ProductionType">ProductionType实体对象</param>
 /// <returns>bool值,判断是否操作成功</returns>
 public bool Change(ProductionType model)
 {
     return(dal.Change(model));
 }
Exemple #22
0
 /// <summary>
 /// 增加
 /// </summary>
 /// <param name="ProductionType">ProductionType实体对象</param>
 /// <returns>int值,返回自增ID</returns>
 public int AddReturnId(ProductionType model)
 {
     return(dal.AddReturnId(model));
 }
Exemple #23
0
 /// <summary>
 /// 增加
 /// </summary>
 /// <param name="ProductionType">ProductionType实体对象</param>
 /// <returns>bool值,判断是否操作成功</returns>
 public bool Add(ProductionType model)
 {
     return(dal.Add(model));
 }
Exemple #24
0
 public void Configure(string SeedID, ProductionType productionType, int newSeedsProduced = 1)
 {
     seedInfo.seedId           = SeedID;
     seedInfo.productionType   = productionType;
     seedInfo.newSeedsProduced = newSeedsProduced;
 }
Exemple #25
0
 /// <summary>
 /// 取得庫存
 /// </summary>
 /// <returns></returns>
 public List <Item> GetStorage(BrandEnum brand, FlavorEnum flavor, PackageEnum package, ProductionType productionType, ProductionDetail productionDetailType)
 {
     return(_stockService.GetStorage(brand, flavor, package, productionType, productionDetailType));
 }