/// <summary> /// 删除表 /// </summary> public void DeleteData() { Database database = null; if (!string.IsNullOrEmpty(ConName)) { database = DatabaseFactory.CreateDatabase(ConName); } else { database = DatabaseFactory.CreateDatabase(); } database.ExecuteDataSet("update " + TableName + " set sysstatus=-1 where " + Key + " ='" + KeyValue + "' " + sql); SysLogCore log = new SysLogCore(); DataSet ds = log.OperatorLog(TableName, KeyValue, KeyValue, "删除", CurrentUser.UserGuid, CurrentUser.UserDN, CurrentUser.UserCN); if (sql != "") { ds.Merge(log.OperatorLog(TableName, KeyValue, sql, "删除子表", CurrentUser.UserGuid, CurrentUser.UserDN, CurrentUser.UserCN)); } database.UpdateDataSet(ds); }
/// <summary> /// 页面数据保存 Insert Update /// </summary> /// <param name="Request">当前Requst</param> public void SaveData(System.Web.HttpRequest Request, string[,] filedValue) { Database database = null; if (!string.IsNullOrEmpty(ConName)) { database = DatabaseFactory.CreateDatabase(ConName); } else { database = DatabaseFactory.CreateDatabase(); } if (KeyValue == "") { if (string.IsNullOrWhiteSpace(StateGuid)) { KeyValue = Guid.NewGuid().ToString(); } else { KeyValue = StateGuid; } DataSet doc = AddData(Request, filedValue, database, TableName, Key); if (RefTable != null && RefTable.GetLength(0) > 0) { for (int i = 0; i < RefTable.GetLength(0); i++) { doc.Merge(AddData(Request, filedValue, database, RefTable[i, 0], RefTable[i, 1])); } } SysLogCore log = new SysLogCore(); string pg = ""; if (!string.IsNullOrEmpty(Request["projguid"])) { pg = Request["Projguid"]; } doc.Merge(log.OperatorLog(TableName, KeyValue, KeyValue, "添加", CurrentUser.UserGuid, CurrentUser.UserDN, CurrentUser.UserCN, pg)); if (childTable != null) { foreach (DataSet ds in childTable) { doc.Merge(ds); } } //*********************添加主管部门审核信息************************** if (string.IsNullOrWhiteSpace(Request["projGuid"]) && (TableName.ToLower().StartsWith("busi") || TableName.ToLower().StartsWith("idty"))) { DataSet confirmDoc = GetData("Busi_AdminConfirm", "Guid", KeyValue); DataRow d = confirmDoc.Tables[0].NewRow(); d["Guid"] = Guid.NewGuid().ToString(); d["RefGuid"] = KeyValue; d["projGuid"] = Request["projGuid"]; d["_table"] = TableName; string currentUrl = System.Web.HttpContext.Current.Request.Url.ToString(); if (currentUrl.ToLower().Contains("/project/")) { currentUrl = "/project/" + currentUrl.ToLower().Replace("/project/", "@").Split('@')[1]; } if (currentUrl.ToLower().Contains("/industrymanager/")) { currentUrl = "/industrymanager/" + currentUrl.ToLower().Replace("/industrymanager/", "@").Split('@')[1]; } d["url"] = currentUrl; confirmDoc.Tables[0].Rows.Add(d); doc.Merge(confirmDoc); } //*********************************************** database.UpdateDataSet(doc); } else { DataSet doc = GetData(); doc.Tables[0].TableName = TableName; UpdateData(Request, doc); if (RefTable != null && RefTable.GetLength(0) > 0) { for (int i = 0; i < RefTable.GetLength(0); i++) { DataSet ds = GetData(RefTable[i, 0], RefTable[i, 1], KeyValue); if (ds.Tables[0].Rows.Count > 0) { UpdateData(Request, ds); } else { doc.Merge(AddData(Request, filedValue, database, RefTable[i, 0], RefTable[i, 1])); } doc.Merge(ds); } } SysLogCore log = new SysLogCore(); string pg = ""; if (!string.IsNullOrEmpty(Request["projguid"])) { pg = Request["Projguid"]; } doc.Merge(log.OperatorLog(TableName, KeyValue, KeyValue, "修改", CurrentUser.UserGuid, CurrentUser.UserDN, CurrentUser.UserCN, pg)); if (childTable != null) { foreach (DataSet ds in childTable) { doc.Merge(ds); } } //****************删除项目退回记录***************** if (TableName.ToLower().StartsWith("busi") || TableName.ToLower().StartsWith("idty")) { DataSet reBackdoc = GetData("Busi_RebackInfo", "refGuid", KeyValue); if (reBackdoc != null && reBackdoc.Tables[0].Rows.Count > 0) { foreach (DataRow d in reBackdoc.Tables[0].Rows) { d.Delete(); } doc.Merge(reBackdoc); } //***********************添加主管部门审核信息******************* if (string.IsNullOrWhiteSpace(Request["projGuid"])) { DataSet confirmDoc = GetData("Busi_AdminConfirm", "refGuid", KeyValue); if (confirmDoc.Tables[0].Rows.Count <= 0) { DataRow d = confirmDoc.Tables[0].NewRow(); d["Guid"] = Guid.NewGuid().ToString(); d["RefGuid"] = KeyValue; d["projGuid"] = Request["projGuid"]; d["_table"] = TableName; string currentUrl = System.Web.HttpContext.Current.Request.Url.ToString(); if (currentUrl.ToLower().Contains("/project/")) { currentUrl = "/project/" + currentUrl.ToLower().Replace("/project/", "@").Split('@')[1]; } if (currentUrl.ToLower().Contains("/industrymanager/")) { currentUrl = "/industrymanager/" + currentUrl.ToLower().Replace("/industrymanager/", "@").Split('@')[1]; } d["url"] = currentUrl; confirmDoc.Tables[0].Rows.Add(d); doc.Merge(confirmDoc); } } } //********************************* database.UpdateDataSet(doc); cPage = null; } }