//Sets meal costs for this company based on the type of establishment. private void SetCompanyBasics(CompanyType type) { switch (type) { //Sets all parameterized settings for the company. case CompanyType.Family: avgCostPerMeal = Settings.Get.FamilyCostPerMeal; avgPricePerMeal = Settings.Get.FamilyPricePerMeal; Reputation += Simulation.Random.Next(0, Settings.Get.FamilyRandomMaxRep) - 8; OutletCapacity = Settings.Get.FamilyOutletCapacity; OutletCost = Settings.Get.FamilyOutletCost; break; case CompanyType.FastFood: avgCostPerMeal = Settings.Get.FastFoodCostPerMeal; avgPricePerMeal = Settings.Get.FastFoodPricePerMeal; Reputation += Simulation.Random.Next(0, Settings.Get.FastFoodRandomMaxRep) - 8; OutletCapacity = Settings.Get.FastFoodOutletCapacity; OutletCost = Settings.Get.FastFoodOutletCost; break; case CompanyType.NamedChef: avgCostPerMeal = Settings.Get.NamedChefCostPerMeal; avgPricePerMeal = Settings.Get.NamedChefPricePerMeal; Reputation += Simulation.Random.Next(0, Settings.Get.NamedChefRandomMaxRep) - 8; OutletCapacity = Settings.Get.NamedChefOutletCapacity; OutletCost = Settings.Get.NamedChefOutletCost; break; default: throw new Exception("Unrecognized company type to set basic parameters for."); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] CompanyType companyType) { if (id != companyType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(companyType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyTypeExists(companyType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(companyType)); }
public async Task <ResponceModel> Add([FromBody] CompanyType model) { var identifier = User.Claims.FirstOrDefault(p => p.Type == "id"); if (identifier == null) { return(new ResponceModel(401, "FAILED", null, new string[] { "Yetkilendirme Hatası." })); } try { var companyType = await companyTypeService.Add(model); if (await companyTypeService.SaveChanges()) { return(new ResponceModel(200, "OK", companyType, null)); } else { return(new ResponceModel(400, "ERROR", null, new string[] { "Şirket kayıt edilirken bir hata oluştu" })); } } catch (Exception ex) { await _logService.Add(new SystemLog() { Content = ex.Message, CreateDate = DateTime.Now, UserId = 0, EntityName = companyTypeService.GetType().Name }); return(new ResponceModel(500, "ERROR", null, new string[] { "Şirket kayıt edilirken bir hata oluştu" })); } }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { CompanyType MasterEntity = (CompanyType)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM Enum_CompanyType WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
private void BtnNew_Click(object sender, EventArgs e) { using (var context = new LaborExchangeEntities()) { if (nameBox.Text == "") { return; } nameBox.NewName = nameBox.Text; if (nameBox.NewName == null) { errorLbl.Visible = true; errorLbl.Text = $"Название уже имеется: {nameBox.Text}"; return; } CompanyType ct = new CompanyType { Type = nameBox.NewName }; context.CompanyType.Add(ct); try { context.SaveChanges(); } catch (Exception exception) { Console.WriteLine(exception); throw; } Response.Redirect("MainPage.aspx"); } }
public async Task <IActionResult> PutCompanyType([FromRoute] int id, [FromBody] CompanyType companyType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != companyType.Id) { return(BadRequest()); } _context.Entry(companyType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private static LotteryModel getLottery(CompanyType companyType, DateTime dt, string lottery) { string[] array = lottery.Split(','); int[] arrayint = new int[array.Length]; for (int i = 0; i < array.Length; i++) { try { arrayint[i] = int.Parse(array[i]); } catch { } } LotteryModel lotteryModel = new LotteryModel(); lotteryModel.Sno = arrayint[0].ToString().PadLeft(4, '0'); lotteryModel.Ymd = dt.ToString("yyyyMMdd"); lotteryModel.Lottery = lottery.Substring(lottery.IndexOf(',') + 1); lotteryModel.Num1 = arrayint[1]; lotteryModel.Num2 = arrayint[2]; lotteryModel.Num3 = arrayint[3]; lotteryModel.Num4 = arrayint[4]; lotteryModel.Num5 = arrayint[5]; lotteryModel.Dtime = dt.ToDateTime(companyType, arrayint[0]); return(lotteryModel); }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private CompanyType EntityGet() { CompanyType entity = new CompanyType(); entity.ID = HTDataID; return(entity); }
public static void RemoveSoft() { SDateTime time = new SDateTime(1, 70); CompanyType type = new CompanyType(); Dictionary <string, string[]> dict = new Dictionary <string, string[]>(); SimulatedCompany simComp = new SimulatedCompany("Trainer Company", time, type, dict, 0f); simComp.CanMakeTransaction(1000000000f); SoftwareProduct[] Products = GameSettings.Instance.simulation.GetAllProducts().Where(product => product.DevCompany == GameSettings.Instance.MyCompany && product.Inventor != GameSettings.Instance.MyCompany.Name).ToArray(); if (Products.Length == 0) { return; } for (int i = 0; i < Products.Length; i++) { SoftwareProduct Product = Products[i]; Product.Userbase = 0; Product.PhysicalCopies = 0; Product.Marketing = 0; Product.Trade(simComp); } WindowManager.SpawnDialog("Products that you didn't invent are removed.", false, DialogWindow.DialogType.Information); }
public void handleExchange(CompanyType biggest, int biggestRemainShare, Dictionary <CompanyType, int> companyPrices) { Dictionary <CompanyType, int> available = getAvailable(companyPrices); available[biggest] = mainPlayer.Share[biggest]; var result = exchangeWindow.exchange(biggest, biggestRemainShare, available); Dictionary <CompanyType, int> source = new Dictionary <CompanyType, int>(); int destinationShareCount = 0; foreach (var r in result) { if (r.Key == biggest) { destinationShareCount = r.Value - mainPlayer.Share[r.Key]; } else { source[r.Key] = mainPlayer.Share[r.Key] - r.Value; } } if (Game.getInstance().exchangeShare(biggest, destinationShareCount, source)) { foreach (var r in result) { mainPlayer.Share[r.Key] = r.Value; } } }
static public Company Create(CompanyType companyType) { switch (companyType) { case CompanyType.avia: { return(new AviaCompany()); } case CompanyType.isurance: { return(new Insurance()); } case CompanyType.provider: { return(new Provider()); } default: { throw new ArgumentException("Unhandled company type"); } } }
public void giveShare(CompanyType com) { if (Game.getInstance().giveShare(com)) { mainPlayer.giveShare(com); } }
private void ChangeKeyLogic() { if (!string.IsNullOrEmpty(SelectedCompanyType.CompanyTypeID)) {//check to see if key is part of the current itemList... CompanyType query = CompanyTypeList.Where(item => item.CompanyTypeID == SelectedCompanyType.CompanyTypeID && item.AutoID != SelectedCompanyType.AutoID).FirstOrDefault(); if (query != null) {//revert it back SelectedCompanyType.CompanyTypeID = SelectedCompanyTypeMirror.CompanyTypeID; //change to the newly selected item... SelectedCompanyType = query; return; } //it is not part of the existing list try to fetch it from the db... CompanyTypeList = GetCompanyTypeByID(SelectedCompanyType.CompanyTypeID); if (CompanyTypeList.Count == 0)//it was not found do new record required logic... { NotifyNewRecordNeeded("Record " + SelectedCompanyType.CompanyTypeID + " Does Not Exist. Create A New Record?"); } else { SelectedCompanyType = CompanyTypeList.FirstOrDefault(); } } else { string errorMessage = "ID Is Required."; NotifyMessage(errorMessage); //revert back to the value it was before it was changed... if (SelectedCompanyType.CompanyTypeID != SelectedCompanyTypeMirror.CompanyTypeID) { SelectedCompanyType.CompanyTypeID = SelectedCompanyTypeMirror.CompanyTypeID; } } }
//CompanyType Object Scope Validation check the entire object for validity... private byte CompanyTypeIsValid(CompanyType item, out string errorMessage) { //validate key errorMessage = ""; if (string.IsNullOrEmpty(item.CompanyTypeID)) { errorMessage = "ID Is Required."; return(1); } EntityStates entityState = GetCompanyTypeState(item); if (entityState == EntityStates.Added && CompanyTypeExists(item.CompanyTypeID)) { errorMessage = "Item AllReady Exists."; return(1); } int count = CompanyTypeList.Count(q => q.CompanyTypeID == item.CompanyTypeID); if (count > 1) { errorMessage = "Item AllReady Exists."; return(1); } //validate Description if (string.IsNullOrEmpty(item.Description)) { errorMessage = "Description Is Required."; return(1); } //a value of 2 is pending changes... //On Commit we will give it a value of 0... return(2); }
private void InitViewBag(StockTrackViewModel info) { ViewBag.CompanyKindList = new SelectList(CompanyType.GetAll(), "Value", "Text"); // 產品類別 ViewBag.ProductKindList = new SelectList(this._GlobalService.GetProductKindList(), "Value", "Text"); // 排列方式 HashSet <MyTextValue> sort = new HashSet <MyTextValue>(); sort.Add(new MyTextValue { Text = "銷售量", Value = "TotalQty", Disabled = false }); sort.Add(new MyTextValue { Text = "銷售總金額", Value = "TotalAmount", Disabled = false }); sort.Add(new MyTextValue { Text = "毛利率(%)", Value = "GrossProfitMargin", Disabled = false }); ViewBag.SortOrderList = new SelectList(sort, "Value", "Text", null); // 倉庫 ViewBag.WareHouseList = new SelectList(this._GlobalService.GetWarehouseList(), "Key", "Value"); }
public static string GetConfigKey(CompanyType companyType, string type) { string key = companyType + type.ToString(); string result = CoreHelper.CustomSetting.GetConfigKey(key); return(result); }
public IQueryable <Temp> GetMetaData(string tableName) { switch (tableName) { case "Companies": Company item = new Company(); return(item.GetMetaData().AsQueryable()); case "CompanyTypes": CompanyType itemType = new CompanyType(); return(itemType.GetMetaData().AsQueryable()); case "CompanyCodes": CompanyCode itemCode = new CompanyCode(); return(itemCode.GetMetaData().AsQueryable()); default: //no table exists for the given tablename given... List <Temp> tempList = new List <Temp>(); Temp temp = new Temp(); temp.ID = 0; temp.Int_1 = 0; temp.Bool_1 = true; //bool_1 will flag it as an error... temp.Name = "Error"; temp.ShortChar_1 = "Table " + tableName + " Is Not A Valid Table Within The Given Entity Collection, Or Meta Data Was Not Defined For The Given Table Name"; tempList.Add(temp); return(tempList.AsQueryable()); } }
/// <summary> /// 更新彩票 /// </summary> /// <param name="dt"></param> /// <param name="ltData"></param> /// <returns></returns> public static bool Update(CompanyType companyType, DateTime dt, List <string> ltData) { try { ///新增开奖号码 List <LotteryModel> lt_LotteryModel = XscpMysqlBLL.SaveLottery(companyType, dt, ltData); ///新增一星走势 XscpMysqlBLL.SaveTendency1(Tendency1Enum.TenThousand, lt_LotteryModel); XscpMysqlBLL.SaveTendency1(Tendency1Enum.Thousand, lt_LotteryModel); XscpMysqlBLL.SaveTendency1(Tendency1Enum.Hundred, lt_LotteryModel); XscpMysqlBLL.SaveTendency1(Tendency1Enum.Ten, lt_LotteryModel); XscpMysqlBLL.SaveTendency1(Tendency1Enum.One, lt_LotteryModel); ///前二、后二 包胆走势 XscpMysqlBLL.SaveTendencyDigit1(lt_LotteryModel); ///所有数字走势 XscpMysqlBLL.SaveTendencyAllDigit(lt_LotteryModel); ///新增二星走势 XscpMysqlBLL.SaveTendency2(Tendency2Enum.Before, lt_LotteryModel); XscpMysqlBLL.SaveTendency2(Tendency2Enum.After, lt_LotteryModel); return(true); } catch (Exception er) { return(false); } }
private void InitData(string type) { if (BasePage.IsOEM) { this.lblOem.Visible = false; } CompanyType companyType = (CompanyType)Enum.Parse(typeof(CompanyType), type); divNotProvider.Visible = companyType != CompanyType.Provider; divProvider.Visible = companyType == CompanyType.Provider; string b3bAccount = Request.QueryString["Account"]; lblProviderAccount.InnerText = lblNotProviderAccount.InnerText = b3bAccount; string accounType = Request.QueryString["AccounType"], name = Request.QueryString["Name"]; string poolpayAcccount = Request.QueryString["pooypayAccount"]; if (!string.IsNullOrEmpty(poolpayAcccount) && b3bAccount != poolpayAcccount) { lbpoolpayAccount1.InnerText = lbpoolpayAccount2.InnerText = "您的国付通账号为:" + poolpayAcccount; lbpoolpayAccount1.Visible = lbpoolpayAccount2.Visible = true; accountTip1.InnerText = accountTip2.InnerText = "欢迎使用" + BasePage.PlatformName + "购买机票!"; } if (bool.Parse(accounType)) { lblNotProviderCompanyName.InnerText = lblProviderCompanyName.InnerText = "您的个人名称为:" + name; } else { lblNotProviderCompanyName.InnerText = lblProviderCompanyName.InnerText = "您的企业名称为:" + name; } }
public IActionResult Edit(int id, [Bind("Id,Title")] CompanyType companyType) { if (id != companyType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { companyTypesRepository.Update(id, companyType); } catch (DbUpdateConcurrencyException) { if (!CompanyTypeExists(companyType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(companyType)); }
/// <summary> /// 将传入数组中的数据显示Fp中 /// </summary> public void ShowData(CompanyType type) { //清空数据 this.dt.Rows.Clear(); Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm(Language.Msg("正在加载数据,请稍候...")); Application.DoEvents(); //取公司记录 ArrayList alCompany = this.phaConsManager.QueryCompany(((int)type).ToString(), false); if (alCompany == null) { Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show(Language.Msg("加载公司数据发生错误" + this.phaConsManager.Err)); return; } Neusoft.HISFC.Models.Pharmacy.Company company; for (int i = 0; i < alCompany.Count; i++) { company = alCompany[i] as Neusoft.HISFC.Models.Pharmacy.Company; this.AddDataToTable(company); } Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); //提交DataTable中的变化。 this.dt.AcceptChanges(); this.SetCellType(); }
/// <summary> /// 设置 /// </summary> public override void EntitySet() { CompanyType entity = new CompanyType(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); txtCode.Text = entity.Code.ToString(); txtName.Text = entity.Name.ToString(); txtOrganizeCode.Text = entity.OrganizeCode.ToString(); txtTel.Text = entity.Tel.ToString(); txtFax.Text = entity.Fax.ToString(); txtAddress.Text = entity.Address.ToString(); txtZipCode.Text = entity.ZipCode.ToString(); txtTaxCode.Text = entity.TaxCode.ToString(); txtBank.Text = entity.Bank.ToString(); txtAccount.Text = entity.Account.ToString(); txtBasedCurrency.Text = entity.BasedCurrency.ToString(); txtDealCurrency.Text = entity.DealCurrency.ToString(); txtRemark.Text = entity.Remark.ToString(); txtEnName.Text = entity.EnName.ToString(); txtEnAddress.Text = entity.EnAddress.ToString(); txtAllName.Text = entity.AllName.ToString(); if (!findFlag) { } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private CompanyType EntityGet() { CompanyType entity = new CompanyType(); entity.ID = HTDataID; entity.SelectByID(); entity.Code = txtCode.Text.Trim(); entity.Name = txtName.Text.Trim(); entity.OrganizeCode = txtOrganizeCode.Text.Trim(); entity.Tel = txtTel.Text.Trim(); entity.Fax = txtFax.Text.Trim(); entity.Address = txtAddress.Text.Trim(); entity.ZipCode = txtZipCode.Text.Trim(); entity.TaxCode = txtTaxCode.Text.Trim(); entity.Bank = txtBank.Text.Trim(); entity.Account = txtAccount.Text.Trim(); entity.BasedCurrency = txtBasedCurrency.Text.Trim(); entity.DealCurrency = txtDealCurrency.Text.Trim(); entity.Remark = txtRemark.Text.Trim(); entity.EnName = txtEnName.Text.Trim(); entity.EnAddress = txtEnAddress.Text.Trim(); entity.AllName = txtAllName.Text.Trim(); return(entity); }
public IEnumerable<BetAutoDropWater> GetDrop(CompanyType companyType, int gameplayway) { string sql = string.Format(@"SELECT * FROM {0} WHERE {1}=@{1} AND {2}=@{2}", BetAutoDropWater.TABLENAME, BetAutoDropWater.COMPANYTYPEID, BetAutoDropWater.GAMEPLAYWAYID); return base.ExecuteList<BetAutoDropWater>(sql, new SqlParameter(BetAutoDropWater.COMPANYTYPEID, (int)companyType), new SqlParameter(BetAutoDropWater.GAMEPLAYWAYID, gameplayway)); }
//All senior tables(Companies, Parts, Orders, ect...) tend to have a generic table called TableNameTypes //i.e. CompanyTypes PartTypes, OrderTypes... //So this will constitute the meta data for that Type table... //Xerp attempts to use generic naming where possible to allow for cloning... public static List <Temp> GetMetaData(this CompanyType entityObject) { XERP.Server.DAL.CompanyDAL.DALUtility dalUtility = new DALUtility(); List <Temp> tempList = new List <Temp>(); int id = 0; using (CompanyEntities ctx = new CompanyEntities(dalUtility.EntityConectionString)) { var c = ctx.CompanyTypes.FirstOrDefault(); var queryResults = from meta in ctx.MetadataWorkspace.GetItems(DataSpace.CSpace) .Where(m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType) from query in (meta as EntityType).Properties .Where(p => p.DeclaringType.Name == entityObject.GetType().Name) select query; if (queryResults.Count() > 0) { foreach (var queryResult in queryResults.ToList()) { Temp temp = new Temp(); temp.ID = id; temp.Name = queryResult.Name.ToString(); temp.ShortChar_1 = queryResult.TypeUsage.EdmType.Name; if (queryResult.TypeUsage.EdmType.Name == "String") { temp.Int_1 = Convert.ToInt32(queryResult.TypeUsage.Facets["MaxLength"].Value); } temp.Bool_1 = false; //we use this as a error trigger false = not an error... tempList.Add(temp); id++; } } } return(tempList); }
private void ToExamine() { Guid id = Guid.Parse(Request.QueryString["CompanyId"]); CompanyType type = (CompanyType)byte.Parse(Request.QueryString["CompanyType"]); AccountBaseType accounType = (AccountBaseType)byte.Parse(Request.QueryString["AccountType"]); AuditType auditType = (AuditType)int.Parse(Request.QueryString["AuditType"]); var address = ChinaPay.B3B.TransactionWeb.PublicClass.AddressShow.GetAddressBaseInfo(hfldAddressCode.Value); bool isUpgrade = false; CompanyUpgrade companyUpgrade = null; if (auditType == AuditType.ApplyAudit) { isUpgrade = true; companyUpgrade = CompanyUpgradeService.QueryCompanyUpgrade(id); } if ((type == CompanyType.Provider && !isUpgrade) || (isUpgrade && companyUpgrade.Type == CompanyType.Provider)) { AccountCombineService.AuditProviderInfo(id, GetProviderAuditInfo(address, isUpgrade)); } else { if (accounType == AccountBaseType.Individual) { AccountCombineService.AuditSupplier(id, GetSupplierIndividualAuditInfo(address, isUpgrade)); } else { AccountCombineService.AuditSupplier(id, GetSupplierEnterpriseInfo(address, isUpgrade)); } } }
public List <Company> SelectCompanies(CompanyType compType, IDbConnection conn) { string sql = @" SELECT ID,CompanyCode,CompanyName,CompanyType,Actived,Remark FROM MD_Company WHERE CompanyType=@CompanyType"; List <SqlParameter> paramList = new List <SqlParameter>(); paramList.Add(new SqlParameter("@CompanyType", compType)); SqlDataReader reader = DataAccessUtil.ExecuteReader(sql, paramList, (SqlConnection)conn); List <Company> list = new List <Company>(); while (reader.Read()) { Company company = new Company(); company.ID = reader.GetInt32(0); company.Code = reader.GetString(1); company.Name = reader.GetString(2); company.CompanyType = (CompanyType)reader.GetInt32(3); company.Actived = reader.GetBoolean(4); if (!reader.IsDBNull(5)) { company.Remark = reader.GetString(5); } list.Add(company); } reader.Close(); return(list); }
protected virtual void CreateCompanies(UnitOfWork session) { CompanyType distributor = session.FindObject <CompanyType>(CriteriaOperator.Parse("Name = ?", "Distributors")); Company fox = CreateCompany(session, "Fox", distributor); Avatar.AddCompany(fox); }
/// <summary> /// 修改 /// </summary> public override void EntityUpdate() { CompanyTypeRule rule = new CompanyTypeRule(); CompanyType entity = EntityGet(); rule.RUpdate(entity); }
public async Task <ActionResult> UpdateAsync(int id, [FromBody] JsonPatchDocument <CompanyTypeInputDto> patchDoc) { if (id <= 0) { return(BadRequest()); } var patchTester = new CompanyTypeInputDto(); patchDoc.ApplyTo(patchTester, ModelState); TryValidateModel(patchTester); if (!ModelState.IsValid) { return(ValidationProblem()); } var companyType = new CompanyType { Id = id }; patchDoc.ApplyTo(companyType); if (await CustomerLogic.UpdateCompanyTypeAsync(companyType)) { return(Ok()); } var errorResult = CheckProblems(); return((ActionResult)errorResult ?? NoContent()); }
void IAnyCompanyListener.OnAnyCompany(GameEntity entity, int id, string name, CompanyType companyType) { if (entity.hasProduct && entity.product.Niche == Flagship.product.Niche) { Render(); } }
public List<DbAppointmentCompany> FindFreeAppointmentByDay(DateTime dayToScedual, CompanyType companyType, CompanySubType companySubType, string location) { List<DbAppointmentCompany> freeAppointmentCompany; switch (companyType) { case CompanyType.Banks: { freeAppointmentCompany = GetData("Bank", companySubType, dayToScedual, location); break; } case CompanyType.MedicalClinic: { freeAppointmentCompany = GetData("MedicalClinic", companySubType, dayToScedual, location); break; } case CompanyType.PostOffice: { freeAppointmentCompany = GetData("PostOffice", companySubType, dayToScedual, location); break; } default: throw new ArgumentOutOfRangeException(nameof(companyType), companyType, null); } return freeAppointmentCompany; }
public NumQuantityCounter GetCounter(GameType gameType, CompanyType companyType, IList<CompanyTypeSupportNumLen> companySupportNumLen) { var key = string.Format("{0}_{1}", (int)gameType, companyType); if (!CounterDic.ContainsKey(key)) { CounterDic.Add(key, BuildCounter(gameType, companySupportNumLen)); } return CounterDic[key]; }
/// <summary> /// Create a test company for running further tests. /// </summary> /// <returns>A test company for running further tests.</returns> public Company CreateCompany(DfpUser user, CompanyType companyType) { CompanyService companyService = (CompanyService) user.GetService( DfpService.v201411.CompanyService); Company company = new Company(); company.name = string.Format("Company #{0}", GetTimeStamp()); company.type = companyType; return companyService.createCompanies(new Company[] {company})[0]; }
/// <summary> /// 根据公司Id获取该公司所支持的号码长度 /// </summary> /// <param name="companyId">The company id.</param> /// <returns></returns> public IEnumerable<CompanyTypeSupportNumLen> GetSupportNumLengthByType(CompanyType companyType) { string sql = string.Format(@"SELECT * FROM {0} NL JOIN {1} CSN ON CSN.{2}=NL.{3} join {4} ct on ct.Id=CSN.CompanyTypeId WHERE CSN.{5}=@{5}", NumLength.TABLENAME, CompanyTypeSupportNumLen.TABLENAME, NumLength.LENID, CompanyTypeSupportNumLen.LENID, CompanyTypeModel.TABLENAME, CompanyTypeSupportNumLen.COMPANYTYPEID); return base.ExecuteList<CompanyTypeSupportNumLen>(sql, new SqlParameter(CompanyTypeSupportNumLen.COMPANYTYPEID, (int)companyType)); }
public int CountAutoDropWater(CompanyType companyType, int gameplaywayId, decimal amount) { string sql = string.Format(@"SELECT COUNT(0) FROM {0} WHERE {1}=@{1} AND {2}=@{2} AND {3}=@{3}", DropWater.TABLENAME, DropWater.COMPANYTYPE, DropWater.GAMEPLAYWAYID, DropWater.AMOUNT); object count = base.ExecuteScalar(sql, new SqlParameter(DropWater.COMPANYTYPE, (int)companyType), new SqlParameter(DropWater.GAMEPLAYWAYID, gameplaywayId), new SqlParameter(DropWater.AMOUNT, amount)); return Convert.ToInt32(count); }
/// <summary> /// 生成订单 /// </summary> /// <param name="amount"></param> /// <param name="user"></param> /// <param name="companyType"></param> /// <returns></returns> public static IPayHistory CreateOrder(decimal amount, string user,CompanyType companyType) { Company.CompanyBase company = GetCompany(companyType); IPayHistory order = null; lock (lockObj) { order = company.CreateOrder(amount, user); } return order; }
private static void SetAdmin(CompanyType ct) { UserType user = new UserType(); user.CompanyCode = ct.Code; user.CompanyName = ct.FullName; user.Username = "******"; user.UserPassword = "******"; user.Sex = "男"; user.Realname = "管理员"; user.Birthday = ""; user.insert(); }
public void AddDefaultUpperLimit(CompanyType companyType, int gameplaywayId, decimal limitAmount) { var limit = DaDefaultLimit.GetDefaultUpperLimit(companyType, gameplaywayId); if (limit != null) throw new BusinessException(Resource.AlreadyExist); limit = new DefaultUpperLimit { CompanyType = companyType, GamePlayWayId = gameplaywayId, LimitAmount = limitAmount }; DaDefaultLimit.Insert(limit); }
public void AddAutoDrop(IEnumerable<string> nums, int gameplayway, double dropValue, decimal amount, CompanyType companyType) { if (DaDropWater.CountAutoDropWater(companyType, gameplayway, amount) > 0) throw new BusinessException(Resource.AlreadyExist); List<DropWater> drops = new List<DropWater>(); foreach (var num in nums) drops.Add(new DropWater { Num = num, GamePlayWayId = gameplayway, DropValue = dropValue, Amount = amount, DropType = DropType.Auto, CompanyType = (int)companyType }); DaDropWater.Insert(drops); }
/// <summary> /// 依赖CustomSetting,名称定义格式为 /// AlipayKey=key /// AlipayUser=user /// [email protected] /// </summary> /// <param name="companyType"></param> /// <param name="type"></param> /// <returns></returns> public static string GetConfigKey(CompanyType companyType,DataType type) { string key = companyType + type.ToString(); //if (accountKeys.Count == 0) //{ // string file = System.Web.Hosting.HostingEnvironment.MapPath("/charge/charge.config"); // string content = System.IO.File.ReadAllText(file); // string entryKey = "S8S7FLDL"; // content = CoreHelper.StringHelper.Decrypt(content, entryKey); // string[] arry = content.Split('\n'); // foreach (string str in arry) // { // string[] arry1 = str.Trim().Split('='); // accountKeys.Add(new KeySetting() { Key = arry1[0], Value = arry1[1] }); // } //} //KeySetting set = accountKeys.Find(b => b.Key.ToUpper() == key.ToUpper()); //if (set != null) // return set.Value; string result = CoreHelper.CustomSetting.GetConfigKey(key); return result; }
public void AddAutoDrop(int gameplayway, double dropValue, decimal amount, CompanyType companyType) { //if (num.IsBatterNum() || num.IsRangeNum() || num.IsNumArray()) //{ // AddAutoDrop(GetRangeNum(num), gameplayway, dropValue, amount, companyType); // return; //} var gpw = LotterySystem.Current.FindGamePlayWay(gameplayway); //var drop = DaDropWater.GetDropWater(num, gameplayway, amount, DropType.Auto, (int)companyType); var drop = DaDropWater.GetDropWater(gameplayway, amount, DropType.Auto, companyType); if (drop != null) throw new BusinessException(Resource.AlreadyExist); drop = new DropWater { Num = GetNumArrange(gpw.GameType), GamePlayWayId = gameplayway, DropValue = dropValue, Amount = amount, DropType = DropType.Auto, CompanyType = (int)companyType }; DaDropWater.Insert(drop); }
protected void Button1_Click(object sender, EventArgs e) { CompanyType ct = new CompanyType(); ct.Code = txtCode.Value.Trim(); if (CompanyType.count("Code='" + ct.Code + "'") > 0) { return; } ct.FullName = txtFullName.Value.Trim(); ct.Manager = txtManager.Value; ct.InnerPhone = txtInnerPhone.Value.Trim(); ct.Address = txtAddress.Value.Trim(); ct.RechargeDate = cvt.ToTime(txtRechargeDate.Value.Trim()); ct.RechargeDay = cvt.ToInt(txtRechargeDay.Value.Trim()); ct.insert(); //添加公司的全权用户admin SetAdmin(ct); //创建数据库 if (DbConfig.Instance.ConnectionStringTable.ContainsKey(ct.Code) == false) { DbConfig.Instance.ConnectionStringTable.Add(ct.Code, (object)string.Format(DbConfig.Instance.ConnectionStringTable[DbConfig.DefaultDbName].ToString(), ct.Code)); DbConfig.checkConnectionString(DbConfig.Instance); DbConfig.SaveConnectionString(); DbConfig.Instance.DbType.Add(ct.Code, ((object)"sqlserver")); MappingClass ms = MappingClass.Instance; foreach (DictionaryEntry entry in ms.ClassList) { EntityInfo entity = entry.Value as EntityInfo; if (entity.Database != "userdb") entity.Database = ct.Code; } MappingClass.createDB(ms, DatabaseType.SqlServer, DbConfig.Instance.ConnectionStringTable[ct.Code].ToString(), ct.Code); } }
partial void InsertCompanyType(CompanyType instance);
partial void UpdateCompanyType(CompanyType instance);
partial void DeleteCompanyType(CompanyType instance);
protected IList<CompanyTypeSupportNumLen> GetComTypeSupportNumLen(CompanyType comType) { if (!ComTypeSupportDic.ContainsKey(comType)) ComTypeSupportDic.Add(comType, ComManager.GetNumLenthByCompanyType(comType).ToList()); return ComTypeSupportDic[comType]; }
/// <summary> /// 计算号码数量(不同玩法中号码所占数量,如2D HN公司4个,18A1个,3D又不同). /// </summary> /// <param name="num">The num.</param> /// <param name="gamePlayWay">The game play way.</param> /// <param name="companyType">Type of the company.</param> /// <param name="isFullPermutation">if set to <c>true</c> [is full permutation].</param> /// <returns></returns> private int CountNumQuantity(string num, GamePlayWay gamePlayWay, CompanyType companyType) { var counter = NumQuantityCounterFactory.GetFactory.GetCounter(gamePlayWay.GameType, companyType, LotterySystem.Current.GetNumLenSupport(companyType)); return counter.CountNumQuantity(num, gamePlayWay.PlayWay); }
string GetClassName(CompanyType companyType) { if (companyType == CompanyType.SpecialCompany) return "我来抢"; //我来抢 else return "我要订"; //我要订 }
public void RemoveAutoDrop(int gameplaywayId, double dropValue, decimal amount, CompanyType companyType) { DaDropWater.Delete(string.Empty, gameplaywayId, dropValue, amount, companyType, DropType.Auto, null); }
public IList<CompanyTypeSupportNumLen> GetNumLenSupport(CompanyType companyType) { if (!NumLenSupportDic.ContainsKey(companyType)) { lock (_lockHelper) { if (!NumLenSupportDic.ContainsKey(companyType)) { var comManager = ManagerHelper.Instance.GetManager<CompanyManager>(); var numLenSupport = comManager.GetNumLenthByCompanyType(companyType).ToList(); NumLenSupportDic.Add(companyType, numLenSupport); } } } return NumLenSupportDic[companyType]; }
public static int GetCompanyIdByTel(string tel, CompanyType? companyType = null) { var query = DB.Select(SysCompany.IdColumn.QualifiedName).From<SysCompany>( ) .Where(SysCompany.CompanyTelColumn).IsEqualTo(tel); if (companyType.HasValue) query.And(SysCompany.CompanyTypeColumn).IsEqualTo((int)companyType.Value); return query.ExecuteScalar<int>( ); }
public static bool FlushCompanyFunc(SysCompany company, CompanyType notAllowType) { CompanyType companyType = Formatter.ToEnum<CompanyType>(company.CompanyType); if (notAllowType == companyType) { HttpContext.Current.Response.Write("商家类型不允许使用此功能"); AppContextBase.Page.Visible = false; //AppContextBase.Page.Response.Flush( ); //AppContextBase.Page.Response.End( ); return true; } return false; }
public static CompanyType CreateCompanyType(short companyTypeID, string type) { CompanyType companyType = new CompanyType(); companyType.CompanyTypeID = companyTypeID; companyType.Type = type; return companyType; }
public void AddToCompanyTypes(CompanyType companyType) { base.AddObject("CompanyTypes", companyType); }
string GetItemType(CompanyType companyType) { return "抢购"; //if (companyType == CompanyType.SpecialCompany) // return "抢购"; //else // return "预订"; }
/// <summary> /// 根据公司类型和玩法获取默认上限限制 /// </summary> /// <param name="companyType">Type of the company.</param> /// <param name="gameplaywayId">The gameplayway id.</param> /// <returns></returns> public DefaultUpperLimit GetDefaultUpperLimit(CompanyType companyType, int gameplaywayId) { string sql = string.Format(@"SELECT * FROM {0} WHERE {1}=@{1} AND {2}=@{2}", DefaultUpperLimit.TABLENAME, DefaultUpperLimit.COMPANYTYPE, DefaultUpperLimit.GAMEPLAYWAYID); return base.ExecuteModel<DefaultUpperLimit>(sql, new SqlParameter(DefaultUpperLimit.COMPANYTYPE, (int)companyType), new SqlParameter(DefaultUpperLimit.GAMEPLAYWAYID, gameplaywayId)); }
public ActionResult GameLimit(int Id, CompanyType companyType, IEnumerable<GameBetLimit> model) { if (Id == 0) PageNotFound(); JsonResultModel result = new JsonResultModel(); if (!(result.IsSuccess = ModelState.IsValid)) { result.Message = ModelState.ToErrorString(); } else { User user = UserManager.GetUser(Id); if (!EditCompanySelf(user) && (user == null || user.ParentId != MatrixUser.UserId)) //只有父级用户才能修改下级的佣金 throw new NoPermissionException("更改用户游戏限制"); UserLimitManager.UpdateGameLimit(user, companyType, model); ActionLogger.Log(CurrentUser, user, LogResources.UpdateUserGameLimit, LogResources.GetUpdateUserGameLimit(user.UserName)); result.Message = Resource.Success; } return Json(result); }
public IEnumerable<BetAutoDropWater> GetAutoDrops(CompanyType companyType, int gameplaywayId) { return DaAutoDrop.GetDrop(companyType, gameplaywayId); }
public void AddBetAutoDrop(CompanyType companyType, int gameplaywayId, decimal amount, double dropValue) { if (DaAutoDrop.GetDrops(companyType, gameplaywayId, amount).Count() > 0) throw new BusinessException(Resource.AlreadyExist); BetAutoDropWater drop = new BetAutoDropWater { CompanyType = companyType, GamePlayWayId = gameplaywayId, Amount = amount, DropValue = dropValue }; DaAutoDrop.Insert(drop); }