コード例 #1
0
        public IHttpActionResult PutLog_Table(int id, Log_Table log_Table)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != log_Table.Log_Table_Id)
            {
                return(BadRequest());
            }

            db.Entry(log_Table).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Log_TableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        private void CanSession_Click(object sender, RoutedEventArgs e)
        {
            current_transaction.Status     = "Cancelled";
            current_transaction.Time_Close = System.DateTime.Now;
            Log_Table log = new Log_Table(current_transaction);

            log.Insert();
            Transaction_Table.Delete(current_transaction.Transaction_Id);

            this.Frame.Navigate(typeof(UserCancelFeedback));
        }
コード例 #3
0
        private void CanSession_Click(object sender, RoutedEventArgs e)
        {
            App.transaction_table.Status     = "Cancelled";
            App.transaction_table.Time_Close = System.DateTime.Now;
            Log_Table log = new Log_Table(App.transaction_table);

            log.Insert();
            Transaction_Table.Delete(App.transaction_table.Transaction_Id);

            this.Frame.Navigate(typeof(VolunteerHome));
        }
コード例 #4
0
        public IHttpActionResult PostLog_Table(Log_Table log_Table)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Log_Table.Add(log_Table);
            db.SaveChanges();

            return(CreatedAtRoute("route1", new { id = log_Table.Log_Table_Id }, log_Table));
        }
コード例 #5
0
        public IHttpActionResult GetLog_Table(int id)
        {
            Log_Table log_Table = db.Log_Table.Find(id);

            if (log_Table == null)
            {
                return(NotFound());
            }
            DTO_Log_Table dlt = new DTO_Log_Table();

            log_Table.ConvertToDTO(dlt);

            return(Ok(dlt));
        }
コード例 #6
0
        public IHttpActionResult DeleteLog_Table(int id)
        {
            Log_Table log_Table = db.Log_Table.Find(id);

            if (log_Table == null)
            {
                return(NotFound());
            }

            db.Log_Table.Remove(log_Table);
            db.SaveChanges();

            return(Ok(log_Table));
        }
コード例 #7
0
ファイル: InitTableManager.cs プロジェクト: plaiuZt/ctms-web
        public void CreateTable <T>(T t) where T : class
        {
            try
            {
                string tableID    = PrimaryKeyHelper.MakePrimaryKey(PrimaryKeyHelper.PrimaryKeyType.Table, PrimaryKeyHelper.PrimaryKeyLen.V1);
                string tableName  = typeof(T).Name;
                string primaryKey = "SystemID";
                string Account    = "sys";
                string NickName   = "系统生成";

                Log_Table entity = new Log_Table();
                entity.TableID    = tableID;
                entity.TableName  = tableName;
                entity.PrimaryKey = primaryKey;
                entity.Account    = Account;
                entity.NickName   = NickName;

                List <Log_TableDetails> lists = new List <Log_TableDetails>();
                PropertyInfo[]          pi    = typeof(T).GetProperties();
                foreach (PropertyInfo p in pi)
                {
                    string columnName = p.Name.ToString();  //得到属性的名称
                    Type   columnType = p.PropertyType;     //得到属性的类型
                    if (p.PropertyType.IsGenericType && p.PropertyType.GetGenericTypeDefinition() == typeof(Nullable <>))
                    {
                        columnType = p.PropertyType.GetGenericArguments()[0];
                    }
                    lists.Add(new Log_TableDetails()
                    {
                        TableID        = tableID,
                        TableName      = tableName,
                        ColumnName     = columnName,
                        ColumnDataType = columnType.Name,
                        Account        = Account,
                        NickName       = NickName,
                    });
                }
                TableService.SaveTable(entity);
                TableDetailsService.SaveTableDetails(lists);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #8
0
        private Log_Table SaveTable(string tableName)
        {
            try
            {
                string    tableID = CreateTableID();
                Log_Table entity  = new Log_Table();
                entity.TableID    = tableID;
                entity.TableName  = tableName;
                entity.PrimaryKey = PrimaryKey;
                entity.Account    = Account;
                entity.NickName   = NickName;

                List <Log_TableDetails> lists = new List <Log_TableDetails>();
                PropertyInfo[]          pi    = typeof(T).GetProperties();
                foreach (PropertyInfo p in pi)
                {
                    string columnName = p.Name.ToString();  //得到属性的名称
                    Type   columnType = p.PropertyType;     //得到属性的类型
                    if (p.PropertyType.IsGenericType && p.PropertyType.GetGenericTypeDefinition() == typeof(Nullable <>))
                    {
                        columnType = p.PropertyType.GetGenericArguments()[0];
                    }
                    lists.Add(new Log_TableDetails()
                    {
                        TableID        = tableID,
                        TableName      = tableName,
                        ColumnName     = columnName,
                        ColumnDataType = columnType.Name,
                        Account        = Account,
                        NickName       = NickName,
                    });
                }
                TableService.SaveTable(entity);
                TableDetailsService.SaveTableDetails(lists);
                return(entity);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }