/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="id">主键Id</param> /// <returns>DataAccess.Model.DIVISION</returns> public DataAccess.Model.DIVISION GetModelForCache(long id) { try { //从缓存中读取指定Id记录 var model = GetModelForCache(x => x.Id == id); if (model == null) { //从数据库中读取 var tem = DIVISION.SingleOrDefault(x => x.Id == id); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取DIVISION表记录时出现异常", e); return(null); } }
/// <summary> /// 获取指定Id记录 /// </summary> /// <param name="id">主键Id</param> /// <param name="isCache">是否从缓存中读取</param> /// <returns>DataAccess.Model.DIVISION</returns> public DataAccess.Model.DIVISION GetModel(long id, bool isCache = true) { //判断是否使用缓存 if (CommonBll.IsUseCache() && isCache) { //从缓存中获取List var list = GetList(); if (list == null) { return(null); } else { //在List查询指定主键Id的记录 return(list.SingleOrDefault(x => x.Id == id)); } } else { //从数据库中直接读取 var model = DIVISION.SingleOrDefault(x => x.Id == id); if (model == null) { return(null); } else { //对查询出来的实体进行转换 return(Transform(model)); } } }
/// <summary> /// 添加与编辑DIVISION记录 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="model">DIVISION表实体</param> /// <param name="content">更新说明</param> /// <param name="isCache">是否更新缓存</param> /// <param name="isAddUseLog">是否添加用户操作日志</param> public void Save(Page page, DIVISION model, string content = null, bool isCache = true, bool isAddUseLog = true) { try { //保存 model.Save(); //判断是否启用缓存 if (CommonBll.IsUseCache() && isCache) { SetModelForCache(model); } if (isAddUseLog) { if (string.IsNullOrEmpty(content)) { content = "{0}" + (model.Id == 0 ? "添加" : "编辑") + "DIVISION记录成功,ID为【" + model.Id + "】"; } //添加用户访问记录 UseLogBll.GetInstence().Save(page, content); } } catch (Exception e) { var result = "执行DIVISIONBll.Save()函数出错!"; //出现异常,保存出错日志信息 CommonBll.WriteLog(result, e); } }
private void DIVIDIR_Click(object sender, EventArgs e) { DIVISION obj4 = new DIVISION(); obj4.Div1 = double.Parse(textBox1.Text); obj4.Div2 = double.Parse(textBox2.Text); label3.Text = obj4.RealizaDIVISION().ToString(); }
private void Start() { int num; QualitySettings.SetQualityLevel(5, true); this.costumeOption = HeroCostume.costumeOption; this.setup = this.character.GetComponent <HERO_SETUP>(); this.setup.init(); this.setup.myCostume = new HeroCostume(); this.copyCostume(HeroCostume.costume[2], this.setup.myCostume, false); this.setup.myCostume.setMesh2(); this.setup.setCharacterComponent(); SEX[] sexArray1 = new SEX[2]; sexArray1[1] = SEX.FEMALE; this.sexOption = sexArray1; this.eyeOption = new int[0x1c]; for (num = 0; num < 0x1c; num++) { this.eyeOption[num] = num; } this.faceOption = new int[14]; for (num = 0; num < 14; num++) { this.faceOption[num] = num + 0x20; } this.glassOption = new int[10]; for (num = 0; num < 10; num++) { this.glassOption[num] = num + 0x30; } this.hairOption = new int[11]; for (num = 0; num < 11; num++) { this.hairOption[num] = num; } this.skinOption = new int[3]; for (num = 0; num < 3; num++) { this.skinOption[num] = num + 1; } this.capeOption = new int[2]; for (num = 0; num < 2; num++) { this.capeOption[num] = num; } DIVISION[] divisionArray1 = new DIVISION[4]; divisionArray1[1] = DIVISION.TheGarrison; divisionArray1[2] = DIVISION.TheMilitaryPolice; divisionArray1[3] = DIVISION.TheSurveryCorps; this.divisionOption = divisionArray1; this.skillOption = new string[] { "mikasa", "levi", "sasha", "jean", "marco", "armin", "petra" }; this.CostumeDataToMyID(); this.freshLabel(); }
public ActionResult Division(Variables n) { DIVISION divi = new DIVISION(); double resultado = 0; if (n.Num2 == 0) { return(Ok("NO SE PUEDE DIVIDIR ENTRE CERO")); } resultado = divi.division(n.Num1, n.Num2); return(Ok(resultado)); }
public static Division ToModel(this DIVISION Table) { if (Table == null) { return(null); } return(new Division() { Id = Table.Id, Descripcion = Table.Descripcion, departamentoId = Table.departamentoId, Fecha_Creacion = Table.Fecha_Creacion }); }
/// <summary> /// 判断指定主键Id的记录是否存在——在IIS缓存或数据库中查找 /// </summary> /// <param name="id">主键Id</param> /// <returns></returns> public bool Exist(int id) { if (id <= 0) { return(false); } //判断是否启用缓存 if (CommonBll.IsUseCache()) { return(Exist(x => x.Id == id)); } //从数据库中查找 return(DIVISION.Exists(x => x.Id == id)); }
private static int DivisionToInt(DIVISION id) { if (id == DIVISION.TheGarrison) { return(0); } if (id == DIVISION.TheMilitaryPolice) { return(1); } if ((id != DIVISION.TheSurveryCorps) && (id == DIVISION.TraineesSquad)) { return(3); } return(2); }
/// <summary> /// Converts this instance of <see cref="Division"/> to an instance of <see cref="DIVISION"/>. /// </summary> /// <param name="dto"><see cref="Division"/> to convert.</param> public static DIVISION ToTable(this Division dto) { if (dto == null) { return(null); } var entity = new DIVISION(); entity.Id = dto.Id; entity.Descripcion = dto.Descripcion; entity.departamentoId = dto.departamentoId; entity.Fecha_Creacion = DateTime.Now; dto.OnEntity(entity); return(entity); }
/// <summary> /// Converts this instance of <see cref="DIVISION"/> to an instance of <see cref="Division"/>. /// </summary> /// <param name="entity"><see cref="DIVISION"/> to convert.</param> public static Division ToModel(this DIVISION entity) { if (entity == null) { return(null); } var dto = new Division(); dto.Id = entity.Id; dto.Descripcion = entity.Descripcion; dto.departamentoId = entity.departamentoId; dto.Fecha_Creacion = entity.Fecha_Creacion; entity.OnDTO(dto); return(dto); }
/// <summary> /// 获取数据表中的某个值——从数据库中查询,如果使用了缓存,删除成功后会清空本表的所有缓存记录,然后重新加载进缓存 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="expression">条件语句</param> /// <param name="isAddUseLog">是否添加用户操作日志</param> public void Delete(Page page, Expression <Func <DIVISION, bool> > expression, bool isAddUseLog = true) { //执行删除 DIVISION.Delete(expression); //判断是否启用缓存 if (CommonBll.IsUseCache()) { //清空当前表所有缓存记录 DelAllCache(); //重新载入缓存 GetList(); } if (isAddUseLog) { //添加用户操作记录 UseLogBll.GetInstence().Save(page, "{0}删除了DIVISION表记录!"); } }
/// <summary> /// 将DIVISION记录实体(SubSonic实体)转换为普通的实体(DataAccess.Model.DIVISION) /// </summary> /// <param name="model">SubSonic插件生成的实体</param> /// <returns>DataAccess.Model.DIVISION</returns> public DataAccess.Model.DIVISION Transform(DIVISION model) { if (model == null) { return(null); } return(new DataAccess.Model.DIVISION { Id = model.Id, DIV_ID = model.DIV_ID, DIV_NAME = model.DIV_NAME, DIV_TYPE = model.DIV_TYPE, STOCK_ID = model.STOCK_ID, DIV_MEMO = model.DIV_MEMO, CRT_DATETIME = model.CRT_DATETIME, CRT_USER_ID = model.CRT_USER_ID, MOD_DATETIME = model.MOD_DATETIME, MOD_USER_ID = model.MOD_USER_ID, LAST_UPDATE = model.LAST_UPDATE, STATUS = model.STATUS, }); }
/// <summary> /// Invoked when <see cref="ToTable"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="DIVISION"/> converted from <see cref="Division"/>.</param> static partial void OnEntity(this Division dto, DIVISION entity);
/// <summary> /// Invoked when <see cref="ToModel"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="Division"/> converted from <see cref="DIVISION"/>.</param> static partial void OnDTO(this DIVISION entity, Division dto);
public ActionResult Division_New(DIVISION newDiv) { try { BLTServiceCaller serviceCaller = BLTServiceCaller.Instance; var request = new RestRequest(Method.POST); request.Resource = "/Divisions"; request.RequestFormat = DataFormat.Xml; request.AddHeader("Content-Type", "application/xml"); //Use extended serializer BLTWebSerializer serializer = new BLTWebSerializer(); request.AddParameter("application/xml", serializer.Serialize<DIVISION>(newDiv), ParameterType.RequestBody); DIVISION createdDiv = serviceCaller.Execute<DIVISION>(request); return RedirectToAction("../Parts/Index"); } catch (Exception e) { return View(e.ToString()); } }
public ActionResult Division_Edit(int id, DIVISION editedDiv) { BLTServiceCaller serviceCaller = BLTServiceCaller.Instance; var request = new RestRequest(Method.POST); request.Resource = "/Divisions/{divisionID}"; request.RequestFormat = DataFormat.Xml; request.AddParameter("divisionID", id, ParameterType.UrlSegment); request.AddHeader("X-HTTP-Method-Override", "PUT"); //Use extended serializer BLTWebSerializer serializer = new BLTWebSerializer(); request.AddParameter("application/xml", serializer.Serialize<DIVISION>(editedDiv), ParameterType.RequestBody); DIVISION updatedDiv = serviceCaller.Execute<DIVISION>(request); //update the AI and go back to the AI index return RedirectToAction("Index"); }
//public enum HIKARI { // NONE = 0, // TSURU = 1, // MAKU = 2, // TSUKI = 3, // ONO = 4, // HOUOU = 5 //} //public enum TANE { // NONE = 0, // UGUISU = 1, // HOTOTOGISU = 2, // YATSUHASHI = 3, // TYOU = 4, // INOSISI = 5, // KARI = 6, // SAKAZUKI = 7, // SHIKA = 8, // TSUBAME = 9 //} //public enum TANZAKU { // NONE = 0, // TANZAKU = 1, // AOTANZAKU = 2, // AKATANZAKU = 3 //} //public enum KASU { // NONE = 0, // KASU1 = 1, // KASU2 = 2, // KASU3 = 3 //} void Start() { fileName = gameObject.name; spriteRenderer = GetComponent <SpriteRenderer>(); //画像の設定 image = new Sprite[2]; image[0] = spriteRenderer.sprite; image[1] = Resources.Load <Sprite>("Hanafuda/Card/Hanafuda_Uramen"); spriteRenderer.sprite = image[1]; //画像の名前から、カードの詳細を設定 var replaceFileName = fileName; string[] split_Name = new string[4]; for (int i = 0; i < split_Name.Length; i++) { if (i < split_Name.Length - 1) { var start = replaceFileName.LastIndexOf("_"); var end = replaceFileName.Length - 1 - start; split_Name[i] = replaceFileName.Substring(start + 1, end); replaceFileName = replaceFileName.Substring(0, start); } else { split_Name[i] = replaceFileName; } } for (int i = 0; i < split_Name.Length; i++) { //Debug.Log(split_Name[i]); switch (i) { case 0: switch (split_Name[i]) { case "Hikari": type = TYPE.HIKARI; break; case "Tane": type = TYPE.TANE; break; case "Tanzaku": type = TYPE.TANZAKU; break; case "Kasu": type = TYPE.KASU; break; case "Bake": type = TYPE.BAKE; break; } break; case 1: switch (split_Name[i]) { case "Tsuru": division = DIVISION.TSURU; break; case "Maku": division = DIVISION.MAKU; break; case "Tsuki": division = DIVISION.TSUKI; break; case "Ono": division = DIVISION.ONO; break; case "Houou": division = DIVISION.HOUOU; break; case "Uguisu": division = DIVISION.UGUISU; break; case "Hototogisu": division = DIVISION.HOTOTOGISU; break; case "Yatsuhashi": division = DIVISION.YATSUHASHI; break; case "Kari": division = DIVISION.KARI; break; case "Sakazuki": division = DIVISION.SAKAZUKI; break; case "Tsubame": division = DIVISION.TSUBAME; break; case "Inosisi": division = DIVISION.INOSISI; break; case "Shika": division = DIVISION.SHIKA; break; case "Tyou": division = DIVISION.TYOU; break; case "Tanzaku": division = DIVISION.TANZAKU; break; case "Akatanzaku": division = DIVISION.AKATANZAKU; break; case "Aotanzaku": division = DIVISION.AOTANZAKU; break; case "Kasu1": division = DIVISION.KASU1; break; case "Kasu2": division = DIVISION.KASU2; break; case "Kasu3": division = DIVISION.KASU3; break; } break; case 2: switch (split_Name[i]) { case "Matsu": flower = FLOWER.MATSU; break; case "Ume": flower = FLOWER.UME; break; case "Sakura": flower = FLOWER.SAKURA; break; case "Fuji": flower = FLOWER.FUJI; break; case "Ayame": flower = FLOWER.AYAME; break; case "Botan": flower = FLOWER.BOTAN; break; case "Hagi": flower = FLOWER.HAGI; break; case "Susuki": flower = FLOWER.SUSUKI; break; case "Kiku": flower = FLOWER.KIKU; break; case "Momiji": flower = FLOWER.MOMIJI; break; case "Yanagi": flower = FLOWER.YANAGI; break; case "Kiri": flower = FLOWER.KIRI; break; } break; case 3: switch (split_Name[i]) { case "Jan": month = MONTH.JAN; break; case "Feb": month = MONTH.FEB; break; case "Mar": month = MONTH.MAR; break; case "Apr": month = MONTH.APR; break; case "May": month = MONTH.MAY; break; case "Jun": month = MONTH.JUN; break; case "Jul": month = MONTH.JUL; break; case "Aug": month = MONTH.AUG; break; case "Sep": month = MONTH.SEP; break; case "Oct": month = MONTH.OCT; break; case "Nov": month = MONTH.NOV; break; case "Dec": month = MONTH.DEC; break; } break; } } }
private void Start() { int num; QualitySettings.SetQualityLevel(5, true); this.costumeOption = HeroCostume.costumeOption; this.setup = this.character.GetComponent <HERO_SETUP>(); this.setup.init(); this.setup.myCostume = new HeroCostume(); //The following statement currently only decides between an AHSS costume and another default blades costume based on the EquipmentType. //This will presumably be updated when the custom hero functionality is made better. //Previously the costume was hardcoded to always generate (soldier) Annie with blades. if (setup.getEquipmentType() == EquipmentType.Ahss) { this.copyCostume(HeroCostume.costume[0x25], this.setup.myCostume, false); //This generates an AHSS soldier. } else { this.copyCostume(HeroCostume.costume[2], this.setup.myCostume, false); //This generates Annie with blades. } this.setup.myCostume.setMesh2(); this.setup.setCharacterComponent(); SEX[] sexArray1 = new SEX[2]; sexArray1[1] = SEX.FEMALE; this.sexOption = sexArray1; this.eyeOption = new int[0x1c]; for (num = 0; num < 0x1c; num++) { this.eyeOption[num] = num; } this.faceOption = new int[14]; for (num = 0; num < 14; num++) { this.faceOption[num] = num + 0x20; } this.glassOption = new int[10]; for (num = 0; num < 10; num++) { this.glassOption[num] = num + 0x30; } this.hairOption = new int[11]; for (num = 0; num < 11; num++) { this.hairOption[num] = num; } this.skinOption = new int[3]; for (num = 0; num < 3; num++) { this.skinOption[num] = num + 1; } this.capeOption = new int[2]; for (num = 0; num < 2; num++) { this.capeOption[num] = num; } DIVISION[] divisionArray1 = new DIVISION[4]; divisionArray1[1] = DIVISION.TheGarrison; divisionArray1[2] = DIVISION.TheMilitaryPolice; divisionArray1[3] = DIVISION.TheSurveryCorps; this.divisionOption = divisionArray1; this.skillOption = new string[] { "mikasa", "levi", "sasha", "jean", "marco", "armin", "petra" }; this.CostumeDataToMyID(); this.freshLabel(); }
public bool UpdateDIVISION(int DIVISIONId, DIVISION DIVISIONEntities) { throw new NotImplementedException(); }
public int CreateDIVISION(DIVISION DIVISIONEntities) { throw new NotImplementedException(); }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.DIVISION</returns> public DataAccess.Model.DIVISION GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.DIVISION model = null; Expression <Func <DIVISION, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "DIV_ID": model = list.SingleOrDefault(x => x.DIV_ID == (string)value); expression = x => x.DIV_ID == (string)value; break; case "DIV_NAME": model = list.SingleOrDefault(x => x.DIV_NAME == (string)value); expression = x => x.DIV_NAME == (string)value; break; case "DIV_TYPE": model = list.SingleOrDefault(x => x.DIV_TYPE == (int)value); expression = x => x.DIV_TYPE == (int)value; break; case "STOCK_ID": model = list.SingleOrDefault(x => x.STOCK_ID == (string)value); expression = x => x.STOCK_ID == (string)value; break; case "DIV_MEMO": model = list.SingleOrDefault(x => x.DIV_MEMO == (string)value); expression = x => x.DIV_MEMO == (string)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; case "STATUS": model = list.SingleOrDefault(x => x.STATUS == (byte)value); expression = x => x.STATUS == (byte)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = DIVISION.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取DIVISION表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取DIVISION表记录 /// </summary> /// <param name="isCache">是否从缓存中读取</param> public IList <DataAccess.Model.DIVISION> GetList(bool isCache = true) { try { //判断是否使用缓存 if (CommonBll.IsUseCache() && isCache) { //检查指定缓存是否过期——缓存当天有效,第二天自动清空 if (CommonBll.CheckCacheIsExpired(const_CacheKey_Date)) { //删除缓存 DelAllCache(); } //从缓存中获取DataTable var obj = CacheHelper.GetCache(const_CacheKey); //如果缓存为null,则查询数据库 if (obj == null) { var list = GetList(false); //将查询出来的数据存储到缓存中 CacheHelper.SetCache(const_CacheKey, list); //存储当前时间 CacheHelper.SetCache(const_CacheKey_Date, DateTime.Now); return(list); } //缓存中存在数据,则直接返回 else { return((IList <DataAccess.Model.DIVISION>)obj); } } else { //定义临时实体集 IList <DataAccess.Model.DIVISION> list = null; //获取全表缓存加载条件表达式 var exp = GetExpression <DIVISION>(); //如果条件为空,则查询全表所有记录 if (exp == null) { //从数据库中获取所有记录 var all = DIVISION.All(); list = all == null ? null : Transform(all.ToList()); } else { //从数据库中查询出指定条件的记录,并转换为指定实体集 var all = DIVISION.Find(exp); list = all == null ? null : Transform(all); } return(list); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取DIVISION表记录时出现异常", e); } return(null); }
private void Start() { int num; QualitySettings.SetQualityLevel(5, true); costumeOption = HeroCostume.costumeOption; setup = character.GetComponent <HERO_SETUP>(); setup.init(); setup.myCostume = new HeroCostume(); copyCostume(HeroCostume.costume[2], setup.myCostume); setup.myCostume.setMesh2(); setup.setCharacterComponent(); var sexArray1 = new SEX[2]; sexArray1[1] = SEX.FEMALE; sexOption = sexArray1; eyeOption = new int[28]; for (num = 0; num < 28; num++) { eyeOption[num] = num; } faceOption = new int[14]; for (num = 0; num < 14; num++) { faceOption[num] = num + 32; } glassOption = new int[10]; for (num = 0; num < 10; num++) { glassOption[num] = num + 48; } hairOption = new int[11]; for (num = 0; num < 11; num++) { hairOption[num] = num; } skinOption = new int[3]; for (num = 0; num < 3; num++) { skinOption[num] = num + 1; } capeOption = new int[2]; for (num = 0; num < 2; num++) { capeOption[num] = num; } var divisionArray1 = new DIVISION[4]; divisionArray1[1] = DIVISION.TheGarrison; divisionArray1[2] = DIVISION.TheMilitaryPolice; divisionArray1[3] = DIVISION.TheSurveryCorps; divisionOption = divisionArray1; skillOption = new[] { "mikasa", "levi", "sasha", "jean", "marco", "armin", "petra" }; CostumeDataToMyID(); freshLabel(); }
/// <summary> /// 更新IIS缓存中指定Id记录 /// </summary> /// <param name="model">记录实体</param> public void SetModelForCache(DIVISION model) { SetModelForCache(Transform(model)); }