public string SaveAsNew(string Program) { DbLibrary DbLibraryControl = new DbLibrary(); DataSet DsAddGameResult = new DataSet(); DataSet DsLogResult = new DataSet(); try { DsAddGameResult = DbLibraryControl.QueryDataSet(string.Format(@"insert into GameBasicInfo values (N'{0}',{1},{2},{3},{4},{5},{6},{7}, N'{8}',{9},{10},'{11}',{12},{13},'{14}','{15}',{16}); select SCOPE_IDENTITY() as GamePK;", this.GameName, this.MinPlayer, this.MaxPlayer, this.Time, this.Difficulty, this.Luck, this.Strategy, this.Interaction, this.ImgName, this.RentalNumber, this.IsExtension, this.RentalStartDate, this.Rent, this.Deposit, this.TeachingUrl, this.Description, this.IsOpen ), "AddGameResult"); foreach (string TreeItemPK in this.GameCategory) { DbLibraryControl.Query(string.Format(@"insert into GameCategory values ({0},{1})", DsAddGameResult.Tables["AddGameResult"].Rows[0]["GamePK"].ToString(), TreeItemPK)); } } catch (Exception ex) { DsLogResult = DbLibraryControl.QueryDataSet(string.Format(@"insert into Log values ('{0}', '{1}', 'SaveAsNew', GetDate()); select SCOPE_IDENTITY() as LogPK;", ex.ToString().Replace("'", ""), Program), "LogResult"); return(DsLogResult.Tables["LogResult"].Rows[0]["LogPK"].ToString()); } return("0"); }
protected void btnDelTypeClick(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hfDelTypePKs.Value)) { DbLibraryControl.Query("delete from TreeItem where PK in (" + hfDelTypePKs.Value + ");delete from GameCategory where TreeItemPK in (" + hfDelTypePKs.Value + ");"); hfDelTypePKs.Value = ""; } }
public string Save(string Program) { DbLibrary DbLibraryControl = new DbLibrary(); try { } catch (Exception ex) { DbLibraryControl.Query(string.Format("insert into Log values ('{0}', '{1}', 'Save', GetDate())", ex.ToString(), Program)); return("1"); } return("0"); }
protected void btnDeleteClick(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hfDelPKs.Value)) { DbLibraryControl.Query(string.Format(@" delete from ScoreRecord where GamePK in ({0}); delete from GameExtension where GamePK in ({0}); delete from GameCategory where GamePK in ({0}); delete from GameBasicInfo where PK in ({0});" , hfDelPKs.Value)); hfDelPKs.Value = ""; btnSearchClick(sender, e); Response.Write("<script>alert('" + GetLocalResourceObject("DeleteSuccess").ToString() + "')</script>"); } }