예제 #1
0
        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();
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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();
            }
        }
예제 #5
0
        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();
            }
        }
예제 #6
0
 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];
 }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
            }
        }
예제 #10
0
        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));
            }
        }
예제 #11
0
        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();
            }
        }
예제 #12
0
 public void DeleteSYS_Modun(SYS_Modun sys_moduns)
 {
     _sys_modunDataAccess.DeleteSYS_Modun(sys_moduns);
 }
예제 #13
0
 public void UpdateSYS_Modun(SYS_Modun sys_modun)
 {
     _sys_modunDataAccess.UpdateSYS_Modun(sys_modun);
 }
예제 #14
0
 public int InsertSYS_Modun(SYS_Modun sys_modun)
 {
     return(_sys_modunDataAccess.InsertSYS_Modun(sys_modun));
 }