public int InsertSYS_Modun(SYS_Modun sys_modun) { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { List <DbParameter> para = new List <DbParameter>(); DbParameter ouput = _DbHelper.CreateParameter(FIELD_ID, DbType.Int32, true); para.Add(_DbHelper.CreateParameter(FIELD_CODE, sys_modun.Code, false)); para.Add(_DbHelper.CreateParameter(FIELD_NAME, sys_modun.Name, false)); para.Add(_DbHelper.CreateParameter(FIELD_CONNECTSTRING, sys_modun.ConnectString, false)); para.Add(_DbHelper.CreateParameter(FIELD_IDUSER, sys_modun.idUser, false)); para.Add(ouput); _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Modun_Insert]", para.ToArray()); return((int)ouput.Value); } catch (Exception ex) { throw new Exception(String.Format("SYS_ModunDataAccess.Insert: {0}", ex.Message)); } finally { conn.Close(); } }
protected void grvPartitionManager_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { string strCn = e.NewValues["ConnectString"] + ""; string code = e.NewValues["Code"] + ""; int IDUser = 0; if (e.NewValues[3] != null) { IDUser = int.Parse(e.NewValues[3] + ""); } TestConnect(strCn, code); var sysPartitionService = new SYS_ModunService(); SYS_ConfigConnectionServer configConnectionServer = new SYS_ConfigConnectionServer(); var partition = new SYS_Modun { Name = e.NewValues["Name"] + "", Code = code, idUser = IDUser, ConnectString = configConnectionServer.EncryptSYS_ConfigConnection(strCn) }; sysPartitionService.InsertSYS_Modun(partition); _DataBind(); e.Cancel = true; grvModunManager.CancelEdit(); //WriteLog("Insert " + e.NewValues["Name"] + "", Action.Create); }
protected void grvPartitionManager_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { string strCn = e.NewValues["ConnectString"] + ""; string code = e.NewValues["Code"] + ""; SYS_Modun sysModun = (SYS_Modun)grvModunManager.GetRow(grvModunManager.EditingRowVisibleIndex); int IDUser = sysModun.idUser; if (e.NewValues["UserName"] != null) { IDUser = int.Parse(e.NewValues["UserName"] + ""); } TestConnect(strCn, code); SYS_ConfigConnectionServer configConnectionServer = new SYS_ConfigConnectionServer(); var sysPartitionService = new SYS_ModunService(); var partition = new SYS_Modun { ID = (int)e.Keys["ID"], Name = e.NewValues["Name"] + "", Code = code, idUser = IDUser, ConnectString = configConnectionServer.EncryptSYS_ConfigConnection(strCn) }; sysPartitionService.UpdateSYS_Modun(partition); _DataBind(); e.Cancel = true; grvModunManager.CancelEdit(); //WriteLog("Update " + e.NewValues["Name"] + "", Action.Update); }
public SYS_Modun SelectSYS_Modun(int ID) { SYS_Modun sys_modun = new SYS_Modun(); DbDataReader reader = null; DbConnection connection = Common.CreateConnection(Common.ConnectionString); connection.Open(); try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Modun_SelectById]", para.ToArray()); if (reader.HasRows && reader.Read()) { SYS_ModunDataAccess.SetSYS_ModunInfo(reader, ref sys_modun); } return(sys_modun); } catch (Exception ex) { throw new Exception(String.Format("SYS_ModunDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } connection.Close(); } }
public void UpdateSYS_Modun(SYS_Modun sys_modun) { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, sys_modun.ID, false)); para.Add(_DbHelper.CreateParameter(FIELD_CODE, sys_modun.Code, false)); para.Add(_DbHelper.CreateParameter(FIELD_NAME, sys_modun.Name, false)); para.Add(_DbHelper.CreateParameter(FIELD_CONNECTSTRING, sys_modun.ConnectString, false)); para.Add(_DbHelper.CreateParameter(FIELD_IDUSER, sys_modun.idUser, false)); _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Modun_Update]", para.ToArray()); } catch (Exception ex) { throw new Exception(String.Format("SYS_ModunDataAccess.Update: {0}", ex.Message)); } finally { conn.Close(); } }
private static void SetSYS_ModunInfo(DbDataReader reader, ref SYS_Modun sys_modun) { sys_modun.ID = int.Parse("0" + reader[FIELD_ID]); sys_modun.Code = "" + reader[FIELD_CODE]; sys_modun.Name = "" + reader[FIELD_NAME]; sys_modun.ConnectString = "" + reader[FIELD_CONNECTSTRING]; sys_modun.idUser = int.Parse("0" + reader[FIELD_IDUSER]); sys_modun.UserName = "" + reader[FIELD_USERNAME]; }
private static void SetListSYS_ModunInfo(ref DbDataReader reader, ref List <SYS_Modun> sys_moduns) { SYS_Modun sys_modun = null; while (reader.Read()) { sys_modun = new SYS_Modun(); SYS_ModunDataAccess.SetSYS_ModunInfo(reader, ref sys_modun); sys_moduns.Add(sys_modun); } }
protected void grvPartitionManager_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { var sysModunService = new SYS_ModunService(); var Modun = new SYS_Modun { ID = (int)e.Keys["ID"] }; sysModunService.DeleteSYS_Modun(Modun); _DataBind(); e.Cancel = true; //WriteLog("Delete " + Modun.Name, Action.Delete); }
private static void SetListSYS_RightInfoModulName(ref DbDataReader reader, ref List <SYS_Right> sys_rights) { SYS_Right sys_right = null; SYS_ModunDataAccess isysModunDataAccess = new SYS_ModunDataAccess(); SYS_Modun sysModun = new SYS_Modun(); while (reader.Read()) { sys_right = new SYS_Right(); SYS_RightDataAccess.SetSYS_RightInfo(reader, ref sys_right); sysModun = isysModunDataAccess.SelectSYS_Modun(sys_right.ModuleID); sys_right.ModuleName = sysModun.Name; sys_rights.Add(sys_right); } }
public void UpdateSYS_Modun(DbTransaction transaction, SYS_Modun sys_modun) { try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, sys_modun.ID, false)); para.Add(_DbHelper.CreateParameter(FIELD_CODE, sys_modun.Code, false)); para.Add(_DbHelper.CreateParameter(FIELD_NAME, sys_modun.Name, false)); para.Add(_DbHelper.CreateParameter(FIELD_CONNECTSTRING, sys_modun.ConnectString, false)); para.Add(_DbHelper.CreateParameter(FIELD_IDUSER, sys_modun.idUser, false)); _DbHelper.ExecuteNonQuery(transaction, Common.DatabaseSchema + "[SYS_Modun_Update]", para.ToArray()); } catch (Exception ex) { throw new Exception(String.Format("SYS_ModunDataAccess.Update: {0}", ex.Message)); } }
public void DeleteSYS_Modun(SYS_Modun sys_modun) { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, sys_modun.ID, false)); _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Modun_Delete]", para.ToArray()); } catch (Exception) { throw; } finally { conn.Close(); } }
public void DeleteSYS_Modun(SYS_Modun sys_moduns) { _sys_modunDataAccess.DeleteSYS_Modun(sys_moduns); }
public void UpdateSYS_Modun(SYS_Modun sys_modun) { _sys_modunDataAccess.UpdateSYS_Modun(sys_modun); }
public int InsertSYS_Modun(SYS_Modun sys_modun) { return(_sys_modunDataAccess.InsertSYS_Modun(sys_modun)); }