/// <summary> /// 修改 /// </summary> /// <param name="diction"></param> /// <returns></returns> public String Update(Diction diction) { try { int result = new BLDiction().Update(diction); if (result > 0) { return(JsonConvert.JavaScriptSerializer(new ExtResult() { success = true, msg = "修改成功" })); } else { return(JsonConvert.JavaScriptSerializer(new ExtResult() { success = false, msg = "修改失败" })); } } catch (Exception ex) { return(JsonConvert.JavaScriptSerializer(new ExtResult() { success = false, msg = "修改失败,失败原因:" + ex.Message })); } }
/// <summary> /// 根据编号查询字典表 /// </summary> /// <param name="Id">编号</param> /// <returns>数据集合</returns> public Diction Select(Decimal Id) { String sql = "select * from Diction where Id=@Id"; System.Data.SQLite.SQLiteParameter[] parm = new System.Data.SQLite.SQLiteParameter[] { new SQLiteParameter("@Id", Id), }; DataTable dt = SqlLiteHelper.GetTable(sql, CommandType.Text, parm); if (dt.Rows.Count > 0) { Diction index = new Diction(); index.Id = dt.Rows[0]["Id"].GetDecimal(); index.Name = dt.Rows[0]["Name"].GetString(); index.Note = dt.Rows[0]["Note"].GetString(); index.ParentId = dt.Rows[0]["Parent_Id"].GetDecimal(); index.OrderId = dt.Rows[0]["Order_Id"].GetDecimal(); index.CreateBy = dt.Rows[0]["Create_By"].GetString(); index.CreateTime = dt.Rows[0]["Create_Time"].GetDateTime(); index.UpdateBy = dt.Rows[0]["Update_By"].GetString(); index.UpdateTime = dt.Rows[0]["Update_Time"].GetDateTime(); return(index); } else { return(null); } }
void Awake() { var scor = GameObject.FindObjectsOfType<Score>(); if(scor.Length> 1) { Destroy(this.gameObject); } DontDestroyOnLoad( this.gameObject); diction = new Diction(); }
internal bool AddDiction(Diction dic) { string str = "INSERT INTO `diction`(`type`, `valuetype`, `name`, `isadd`, `isedit`, `isdelete`, `authorizelevel`) " + "VALUES('{0}', '{1}', '{2}', {3}, {4}, {5},' {6}')"; string sql = string.Format(@str, dic.type, dic.valuetype, dic.name, dic.isadd, dic.isedit, dic.isdelete, dic.authorizelevel); int row = mSql.ExcuteSql(sql); return(row >= 1); }
//checker for even public void checker1(Button btn, Timer timer, Diction d) { //if are pressed two buttons if (timer.Enabled) { Task.Delay(TimeSpan.FromSeconds(1)); //Thread.Sleep(1000); } else { //button1.Text = dict0.Pol; btn.Text = d.Pol; //if press the same language in other button //if (check.Btn1 != null) if (Btn1 != null) { //button1.Text = check.Btn1.Text = null; Btn2 = btn; //timer timer.Start(); //check.Btn1 = button1; } else { Btn1 = btn; Pol = d.Pol; //if 2 buttons pressed if (checkButtons()) { //shot hit if (Eng == d.Eng && Pol == d.Pol) { btn.Text = d.Pol; Btn1.Enabled = Btn2.Enabled = false; Btn1 = Btn2 = null; Pol = Eng = null; } else { //shot miss, clear all //timer timer.Start(); } } else { //one button press btn.Text = Pol = d.Pol; Btn1 = btn; } } } }
public bool AddDiction(Diction dic, out string result) { result = ""; if (PubMaster.Mod.DicSql.AddDiction(dic)) { Refresh(true, false); return(true); } return(false); }
public void SetValue(Diction odic, Diction ndic) { odic.name = ndic.name; odic.isadd = ndic.isadd; odic.isedit = ndic.isedit; odic.isdelete = ndic.isdelete; odic.type = ndic.type; odic.valuetype = ndic.valuetype; odic.authorizelevel = ndic.authorizelevel; }
internal bool EditDiction(Diction dic) { string sql = "UPDATE diction set type = '{0}', `name` = '{1}', isadd = {2}, isedit = {3}" + ", isdelete = {4}, authorizelevel = '{5}', valuetype = '{6}' where id = '{7}'"; sql = string.Format(sql, dic.valuetype, dic.name, dic.isadd, dic.isedit, dic.isdelete, dic.authorizelevel, dic.valuetype, dic.id); int row = mSql.ExcuteSql(sql); return(row >= 1); }
public bool AddDiction(Diction dic, out string result) { result = ""; if (PubMaster.Mod.DicSql.AddDiction(dic)) { mLog.Info(true, string.Format(@"新增字典名【{0}】", dic.name)); Refresh(true, false); return(true); } return(false); }
public bool EditDiction(Diction dic, out string result) { result = ""; Diction d = GetDiction(dic.id); SetValue(d, dic); if (!PubMaster.Mod.DicSql.EditDiction(d)) { result = "数据没有更改!"; return(false); } Refresh(true, false); return(true); }
public bool EditDiction(Diction dic, out string result) { result = ""; Diction d = GetDiction(dic.id); SetValue(d, dic); if (!PubMaster.Mod.DicSql.EditDiction(d)) { result = "数据没有更改!"; return(false); } mLog.Info(true, string.Format(@"编辑字典名【{0}】", dic.name)); Refresh(true, false); return(true); }
//проверка наличия всех справочников и фильтров public static void CheckDictionaries(XDocument template) { LogEvent.Write("Начинаем проверку справочников"); var listNeedDic = MakeNeedDictionaries(template); var listNeedFilterDic = MakeNeedFilterDictionaries(template); foreach (var dic in listNeedDic.Where(dic => !Diction.Contains(dic))) { LogEvent.Write("Справочник " + dic + " отсутствует в шаблоне"); } foreach (var dic in listNeedFilterDic.Where(dic => !DicFilter.Contains(dic))) { LogEvent.Write("Фильтр справочника " + dic + " отсутствует в шаблоне"); } LogEvent.Write("Закончили проверки справочников"); }
/// <summary> /// 修改字典表 /// </summary> /// <param name="index">字典表对象</param> /// <returns></returns> public int Update(Diction index) { string sql = "update Diction set Id=@Id,Name=@Name,Note=@Note,Parent_Id=@Parent_Id,Order_Id=@Order_Id,Create_By=@Create_By,Create_Time=@Create_Time,Update_By=@Update_By,Update_Time=@Update_Time where Id=@Id"; SQLiteParameter[] parm = new SQLiteParameter[] { new SQLiteParameter("@Id", index.Id), new SQLiteParameter("@Name", index.Name), new SQLiteParameter("@Note", index.Note), new SQLiteParameter("@Parent_Id", index.ParentId), new SQLiteParameter("@Order_Id", index.OrderId), new SQLiteParameter("@Create_By", index.CreateBy), new SQLiteParameter("@Create_Time", index.CreateTime), new SQLiteParameter("@Update_By", index.UpdateBy), new SQLiteParameter("@Update_Time", index.UpdateTime) }; return(SqlLiteHelper.ExecuteNonQuery(sql, CommandType.Text, parm)); }
/// <summary> /// 增加字典表 /// </summary> /// <param name="index">字典表对象</param> /// <returns></returns> public int Add(Diction index) { string sql = string.Format("insert into Diction(Id,Name,Note,Parent_Id,Order_Id,Create_By,Create_Time,Update_By,Update_Time) values(@Id,@Name,@Note,@Parent_Id,@Order_Id,@Create_By,@Create_Time,@Update_By,@Update_Time)"); SQLiteParameter[] parm = new SQLiteParameter[] { new SQLiteParameter("@Id", index.Id), new SQLiteParameter("@Name", index.Name), new SQLiteParameter("@Note", index.Note), new SQLiteParameter("@Parent_Id", index.ParentId), new SQLiteParameter("@Order_Id", index.OrderId), new SQLiteParameter("@Create_By", index.CreateBy), new SQLiteParameter("@Create_Time", index.CreateTime), new SQLiteParameter("@Update_By", index.UpdateBy), new SQLiteParameter("@Update_Time", index.UpdateTime) }; return(SqlLiteHelper.ExecuteNonQuery(sql, CommandType.Text, parm)); }
/// <summary> /// 保存 /// </summary> /// <param name="diction"></param> /// <returns></returns> public String Save(Diction diction) { Users user = Session["user"] as Users; if (diction.Id == 0) { diction.CreateTime = diction.UpdateTime = DateTime.Now; diction.CreateBy = diction.UpdateBy = user.Name; return(Add(diction)); } else { diction.UpdateTime = DateTime.Now; diction.UpdateBy = user.Name; return(Update(diction)); } }
public void LoadToDB(Dictionary <string, int> DictWords) { try { using (DictionContext db = new DictionContext()) { foreach (KeyValuePair <string, int> kvp in DictWords) { Diction row = new Diction { Word = kvp.Key, Repeat = kvp.Value }; db.Dict.Add(row); } db.SaveChanges(); } } catch (Exception ex) { Console.WriteLine(ex); } }
/// <summary> /// 新增 /// </summary> /// <param name="diction"></param> /// <returns></returns> public String Add(Diction diction) { try { decimal parentId = Request["parentId"].GetDecimal(); List <Diction> list = new BLDiction().Select(new HashTableExp("ParentId", parentId.GetString())); if (list.Count > 0) { diction.Id = list.Max(f => f.Id) + 1; } else { diction.Id = parentId + 1; } int result = new BLDiction().Add(diction); if (result > 0) { return(JsonConvert.JavaScriptSerializer(new ExtResult() { success = true, msg = "新增成功" })); } else { return(JsonConvert.JavaScriptSerializer(new ExtResult() { success = false, msg = "新增失败" })); } } catch (Exception ex) { return(JsonConvert.JavaScriptSerializer(new ExtResult() { success = false, msg = "新增失败,失败原因:" + ex.Message })); } }
/// <summary> /// 分页查询字典表 /// </summary> /// <param name="pageSize">每页多少条数据</param> /// <param name="start">排除多少条数据</param> /// <param name="hash">筛选条件</param> /// <param name="total">总共多少条</param> /// <returns>数据集合</returns> public List <Diction> Select(int pageSize, int start, HashTableExp hash, out int total, String sqlWhere) { List <Diction> list = new List <Diction>(); sqlWhere = "1=1 " + sqlWhere; #region 查询条件 if (hash != null) { if (hash["Id"] != null) { sqlWhere += string.Format(" and Id='{0}'", hash["Id"]); } if (hash["Name"] != null) { sqlWhere += string.Format(" and Name='{0}'", hash["Name"]); } if (hash["Note"] != null) { sqlWhere += string.Format(" and Note='{0}'", hash["Note"]); } if (hash["ParentId"] != null) { sqlWhere += string.Format(" and Parent_Id='{0}'", hash["ParentId"]); } if (hash["OrderId"] != null) { sqlWhere += string.Format(" and Order_Id='{0}'", hash["OrderId"]); } if (hash["CreateBy"] != null) { sqlWhere += string.Format(" and Create_By='{0}'", hash["CreateBy"]); } if (hash["CreateTime"] != null) { sqlWhere += string.Format(" and Create_Time='{0}'", hash["CreateTime"]); } if (hash["UpdateBy"] != null) { sqlWhere += string.Format(" and Update_By='{0}'", hash["UpdateBy"]); } if (hash["UpdateTime"] != null) { sqlWhere += string.Format(" and Update_Time='{0}'", hash["UpdateTime"]); } } #endregion DataTable dt = SqlLiteHelper.GetTable("Diction", "Id,Name,Note,Parent_Id,Order_Id,Create_By,Create_Time,Update_By,Update_Time", pageSize, start, sqlWhere, "Id", "asc", out total); for (int i = 0; i < dt.Rows.Count; i++) { Diction index = new Diction(); index.Id = dt.Rows[i]["Id"].GetDecimal(); index.Name = dt.Rows[i]["Name"].GetString(); index.Note = dt.Rows[i]["Note"].GetString(); index.ParentId = dt.Rows[i]["Parent_Id"].GetDecimal(); index.OrderId = dt.Rows[i]["Order_Id"].GetDecimal(); index.CreateBy = dt.Rows[i]["Create_By"].GetString(); index.CreateTime = dt.Rows[i]["Create_Time"].GetDateTime(); index.UpdateBy = dt.Rows[i]["Update_By"].GetString(); index.UpdateTime = dt.Rows[i]["Update_Time"].GetDateTime(); list.Add(index); } return(list); }
/// <summary> /// 新增 /// </summary> /// <returns>影响的行数</returns> public int Add(Diction diction) { return(dLDiction.Add(diction)); }
/// <summary> /// 修改 /// </summary> /// <returns>影响的行数</returns> public int Update(Diction diction) { return(dLDiction.Update(diction)); }
/// <summary> /// 查询所有数据 /// </summary> /// <returns></returns> public List <Diction> Select(HashTableExp hash, String sqlWhere) { List <Diction> list = new List <Diction>(); string sql = "select Id,Name,Note,Parent_Id,Order_Id,Create_By,Create_Time,Update_By,Update_Time from Diction where 1=1 "; #region 查询条件 if (hash != null) { if (hash["Id"] != null) { sql += string.Format(" and Id='{0}'", hash["Id"]); } if (hash["Name"] != null) { sql += string.Format(" and Name='{0}'", hash["Name"]); } if (hash["Note"] != null) { sql += string.Format(" and Note='{0}'", hash["Note"]); } if (hash["ParentId"] != null) { sql += string.Format(" and Parent_Id='{0}'", hash["ParentId"]); } if (hash["OrderId"] != null) { sql += string.Format(" and Order_Id='{0}'", hash["OrderId"]); } if (hash["CreateBy"] != null) { sql += string.Format(" and Create_By='{0}'", hash["CreateBy"]); } if (hash["CreateTime"] != null) { sql += string.Format(" and Create_Time='{0}'", hash["CreateTime"]); } if (hash["UpdateBy"] != null) { sql += string.Format(" and Update_By='{0}'", hash["UpdateBy"]); } if (hash["UpdateTime"] != null) { sql += string.Format(" and Update_Time='{0}'", hash["UpdateTime"]); } } #endregion sql += sqlWhere; DataTable dt = SqlLiteHelper.GetTable(sql, CommandType.Text, null); for (int i = 0; i < dt.Rows.Count; i++) { Diction index = new Diction(); index.Id = dt.Rows[i]["Id"].GetDecimal(); index.Name = dt.Rows[i]["Name"].GetString(); index.Note = dt.Rows[i]["Note"].GetString(); index.ParentId = dt.Rows[i]["Parent_Id"].GetDecimal(); index.OrderId = dt.Rows[i]["Order_Id"].GetDecimal(); index.CreateBy = dt.Rows[i]["Create_By"].GetString(); index.CreateTime = dt.Rows[i]["Create_Time"].GetDateTime(); index.UpdateBy = dt.Rows[i]["Update_By"].GetString(); list.Add(index); } return(list); }
// Use this for initialization void Start() { letters = new char[16]; for(int i = 0; i < 5;i++) { letters[i] = GetRandomVowel(); } for(int i = 5; i < 16;i++) { letters[i] = GetRandomChar(); } activatedLetters = new LetterController[16]; currentActivated = 0; shuffle(); Row1[0].SetChar(letters[0]); Row1[1].SetChar(letters[1]); Row1[2].SetChar(letters[2]); Row1[3].SetChar(letters[3]); Row2[0].SetChar(letters[4]); Row2[1].SetChar(letters[5]); Row2[2].SetChar(letters[6]); Row2[3].SetChar(letters[7]); Row3[0].SetChar(letters[8]); Row3[1].SetChar(letters[9]); Row3[2].SetChar(letters[10]); Row3[3].SetChar(letters[11]); Row4[0].SetChar(letters[12]); Row4[1].SetChar(letters[13]); Row4[2].SetChar(letters[14]); Row4[3].SetChar(letters[15]); score = FindObjectOfType<Score>(); score.showScore = true; diction = score.diction; usedWords = new HashSet<string>(); }